Thanks.

Another question about formlets: when I use (formlet-process formlet-name)
it will often raise errors when a field doesn't have a value. Is there an
easy way of capturing errors, in particular to show the form as it was
entered by the user, but with an error message at the top, rather than
blowing up?

One way I can imagine doing this is to catch the errors via (with-handlers
... ), and then resend the form with previous answers pre-populated. So, I
would do the following, where 'answer' is the string ("Yes" or "No") that
was associated with the checked answer previously.

(define (rg-formlet answer)
  (define (was-answer? a)
    (equal? a answer))
  (formlet
    (label
      ,{(radio-group '("Yes" "No") #:checked was-answer?) . => . answer})
    answer))

Is this the way to do it, or is there an easier way (since forms with
missing elements can't be such a rarity - and yes, I'll do checking on the
client-side as well).

Thanks,
Marc

On Sun, Jan 10, 2016 at 5:08 PM, Jay McCarthy <jay.mccar...@gmail.com>
wrote:

> On Sun, Jan 10, 2016 at 3:50 PM, Marc Kaufmann
> <marc.kaufman...@gmail.com> wrote:
> > Hi,
> >
> > I manage to get the basic formlets to work, and tried the radiogroup,
> but it
> > fails with the following error: "input-group: invalid selection #f", even
> > though I had it selected. After some playing around, I saw that there are
> > two input_0 fields being sent on submit, since I have another formlet on
> the
> > same page (with a separate formlet-display and formlet-process).
> >
> > My question is: If I use formlets, do I have to put all the formlets into
> > one big formlet on every page, as otherwise fields will have the same
> name
> > attribute, and there will be clashes?
>
> Each form can have only one formlet. There can be different forms on a
> page, I believe.
>
> Jay
>
> > Thanks,
> > Marc
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to racket-users+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Jay McCarthy
> Associate Professor
> PLT @ CS @ UMass Lowell
> http://jeapostrophe.github.io
>
>            "Wherefore, be not weary in well-doing,
>       for ye are laying the foundation of a great work.
> And out of small things proceedeth that which is great."
>                           - D&C 64:33
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to