Helpers has an implicit from String to Node. Also, the list of validators should contain functions that take a mapper IIRC. So if the function needs more specifics, put the other arguments in a parameter list before. For examples see the built in validators name valXXX in various mapped field classes.
------------------------------------- fbettag<fr...@bett.ag> wrote: Heyho folks, i've been running into troubles when trying to validate records. In the liftbook it says the following: import _root_.java.util.Date def noFutureDates (time : Date) = { if (time.getTime > System.currentTimeMillis) { List(FieldError(this, "You cannot make future expense entries")) } else { List[FieldError]() } } object dateOf extends MappedDateTime(this) { }override def validations = noFutureDates _ :: Nil } Besides the fact that FieldError awaits an XmlNode as second parameter, the first parameter "this" will be seen from the classes point of view which will fail to compile (since the class for the record isn't a FieldIdentifier). I tried this: object startHour extends MappedInt(this) { override def validations = validateHours(this, _) :: Nil } object stopHour extends MappedInt(this) { override def validations = validateHours(this, _) :: Nil } /* Validations */ def validateHours(field: FieldIdentifier, hour: Int) = if (hour < 0 || hour > 23) { List(FieldError(field, <span>Only values between 0 and 23 are allowed</span>)) } else { List[FieldError]() } This fails at the override lines at the point of _) , it says: error: missing parameter type for expanded function ((x$3) => { <synthetic> val x$4 = validateHours(this, x$3); Nil.$colon$colon(x$4) Since i didn't find anything describing how to properly validate metamapper models, i guess i have to ask here ;) Some working samples in that direction would be reeeeeeeeeeeally helpful. best regards! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---