On Thu, Apr 23, 2009 at 12:01 PM, g-man <gregor...@gmail.com> wrote:

>
> Nice -- I'm getting the spirit of Lift now; it's kind of a way of
> saying 'NULL or Validate', right?
>

Yes.


>
>
> On Apr 23, 10:39 am, David Pollak <feeder.of.the.be...@gmail.com>
> wrote:
> > How about:
> >
> > class MappedBlankableEmail[T<:Mapper[T]](owner: T, maxLen: Int) extends
> > MappedString[T](owner, maxLen) {
> >
> >   override def setFilter = notNull _ :: toLower _ :: trim _ ::
> > super.setFilter
> >
> >   override def validate =
> >     (if (*i_is_!.length == 0 ||
> > *MappedEmail.emailPattern.matcher(i_is_!).matches)
> > Nil else List(FieldError(this, Text(S.??("invalid.email.address"))))) :::
> >     super.validate
> >
> >
> >
> > }
> > On Wed, Apr 22, 2009 at 8:10 PM, g-man <gregor...@gmail.com> wrote:
> >
> > > All is going well with my Lift learning...
> >
> > > The form field validations are working well, and I especially like the
> > > field object types that know what they are, like 'email'.
> >
> > > My question is:
> >
> > > How do I tell Lift that a Contact's email is optional (empty string is
> > > OK), but if it is provided, then validate it?
> >
> > > This is not for the regular User model, but only for Contacts I am
> > > entering in an address book.
> >
> > > Thanks!
> >
> > --
> > Lift, the simply functional web frameworkhttp://liftweb.net
> > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > Follow me:http://twitter.com/dpp
> > Git some:http://github.com/dpp
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to