I think the idea is to be a little more declarative on defining the form and
separate the low-level concerns of handling all the events to a more generic
form handler,
object ShipToForm extends Form {
val name = Variable[String](customerName)
val address1: Variable[String]()
val address2: Variable[String]()
val state: Variable[String]()
val zip: Variable[String]()
val form =
TextField("Name", name, StringLengthValidator(30)) ++
TextField("Address 1", address1, StringLengthValidator(20)) ++
TextField("Address 2", address2, StringLengthValiator(20)) ++
TextField("State", state, listOfStates) ++
TextField("Zip", zip, ZipCodeValidator) ++
) ++ FullAddressValidator(address1, address2, state, zip)
val onSubmit = {
// everything has been validated
}
}
bind("shipTo", AjaxifyForm(ShipToForm))
or
bind("shipTo", PlainOldForm(ShipToForm))
alex
On Thu, Dec 17, 2009 at 11:07 AM, Naftoli Gugenheim <[email protected]>wrote:
> What would such an abstraction do?
> What code would you like to write (including templates) and what should it
> do?
>
> -------------------------------------
> Alex Boisvert<[email protected]> wrote:
>
> Indeed, if you're building a lot of forms, you quickly realize that Lift
> currently requires fair amount of code for forms that are not backed by
> mapper elements. There's space there for better abstrations / DSL
> improvements to reduce boilerplate -- similar to what David has built for
> the new wizard.
>
> alex
>
>
> On Wed, Dec 16, 2009 at 8:47 AM, greekscala <[email protected]>
> wrote:
>
> > Hello lift people,
> >
> > lift seems very promising. I am trying to make some tests
> > and examples because I am new to lift.
> > I wanted to add some validation to a form element and show
> > the validation error to the user.
> > But after little searching I was a little disappointet to see that
> > there
> > is no such support, exept when using Mapper. I do not want to use
> > Mapper. I want only simple field validation with the errors messages
> > printed in a feedback panel.
> >
> > Before lift I was using Wicket. I think they did a good job with the
> > validators.
> >
> > I try to understand why lift has not such support? I do not want to
> > code
> > everything in my submit method and validate things there.
> >
> > best regards
> >
> > --
> >
> > You received this message because you are subscribed to the Google Groups
> > "Lift" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<liftweb%[email protected]>
> <liftweb%[email protected]<liftweb%[email protected]>
> >
> > .
> > For more options, visit this group at
> > http://groups.google.com/group/liftweb?hl=en.
> >
> >
> >
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<liftweb%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en.