[Lift] Re: How to stop validations if previous validator returns error.
On Sun, Oct 4, 2009 at 2:12 AM, ishiijp wrote: > > Hi. I have found StopValidationOnError trait in Mapper.scala, > But I couldn't understand how to use it. > Please show me a example. > > def stopableValMaxLen: (String => List[FieldError]) with StopValidationOnError[String] = new (String => List[FieldError]) with StopValidationOnError[String] { def apply(in: String) = valMaxLen(32, "Too long")(in) } > thanks. > > On 9月15日, 午前4:08, David Pollak wrote: > > I'll check code in after it passes the reviewboard process that let's you > > mix in: > > trait StopValidationOnError[T] extends Function1[T, List[FieldError]] > > > > to a validation function such that the validator will stop processing a > > given field if a validator that has that trait mixed in returns a > validation > > error. > > > > > > > > > > > > On Sun, Sep 6, 2009 at 3:02 PM, ishiijp > wrote: > > > > > I'm looking for a way to stop MappedField validations if prefvious > > > validator returns error. > > > > > For example: > > > > > object Alphabets extends MappedString(this, 20) { > > > override def validations = > > >valMinLen(1, "Alphabets is required") _ :: > > >valRegex(Pattern.compile("^[a-zA-Z]+$", "It's not alphabets!") > > > _ :: > > >super.validations > > > } > > > > > if valMinLen returns error, I don't want to process valRegex. > > > > > My solutions are > > > (1) define custom validator which works as I want. > > > (2) override MappedField#validate() > > > > > If you have other ideas, please help me. > > > > > Thanks in advance. > > > > -- > > 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 Surf the harmonics --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Lift] Re: How to stop validations if previous validator returns error.
Hi. I have found StopValidationOnError trait in Mapper.scala, But I couldn't understand how to use it. Please show me a example. thanks. On 9月15日, 午前4:08, David Pollak wrote: > I'll check code in after it passes the reviewboard process that let's you > mix in: > trait StopValidationOnError[T] extends Function1[T, List[FieldError]] > > to a validation function such that the validator will stop processing a > given field if a validator that has that trait mixed in returns a validation > error. > > > > > > On Sun, Sep 6, 2009 at 3:02 PM, ishiijp wrote: > > > I'm looking for a way to stop MappedField validations if prefvious > > validator returns error. > > > For example: > > > object Alphabets extends MappedString(this, 20) { > > override def validations = > > valMinLen(1, "Alphabets is required") _ :: > > valRegex(Pattern.compile("^[a-zA-Z]+$", "It's not alphabets!") > > _ :: > > super.validations > > } > > > if valMinLen returns error, I don't want to process valRegex. > > > My solutions are > > (1) define custom validator which works as I want. > > (2) override MappedField#validate() > > > If you have other ideas, please help me. > > > Thanks in advance. > > -- > 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 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Lift] Re: How to stop validations if previous validator returns error.
Very nice! thanks a lot!! On 9月15日, 午前4:08, David Pollak wrote: > I'll check code in after it passes the reviewboard process that let's you > mix in: > trait StopValidationOnError[T] extends Function1[T, List[FieldError]] > > to a validation function such that the validator will stop processing a > given field if a validator that has that trait mixed in returns a validation > error. > > > > > > On Sun, Sep 6, 2009 at 3:02 PM, ishiijp wrote: > > > I'm looking for a way to stop MappedField validations if prefvious > > validator returns error. > > > For example: > > > object Alphabets extends MappedString(this, 20) { > > override def validations = > > valMinLen(1, "Alphabets is required") _ :: > > valRegex(Pattern.compile("^[a-zA-Z]+$", "It's not alphabets!") > > _ :: > > super.validations > > } > > > if valMinLen returns error, I don't want to process valRegex. > > > My solutions are > > (1) define custom validator which works as I want. > > (2) override MappedField#validate() > > > If you have other ideas, please help me. > > > Thanks in advance. > > -- > 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 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Lift] Re: How to stop validations if previous validator returns error.
I'll check code in after it passes the reviewboard process that let's you mix in: trait StopValidationOnError[T] extends Function1[T, List[FieldError]] to a validation function such that the validator will stop processing a given field if a validator that has that trait mixed in returns a validation error. On Sun, Sep 6, 2009 at 3:02 PM, ishiijp wrote: > > I'm looking for a way to stop MappedField validations if prefvious > validator returns error. > > For example: > > object Alphabets extends MappedString(this, 20) { > override def validations = >valMinLen(1, "Alphabets is required") _ :: >valRegex(Pattern.compile("^[a-zA-Z]+$", "It's not alphabets!") > _ :: >super.validations > } > > if valMinLen returns error, I don't want to process valRegex. > > My solutions are > (1) define custom validator which works as I want. > (2) override MappedField#validate() > > If you have other ideas, please help me. > > Thanks in advance. > > > > -- 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 -~--~~~~--~~--~--~---