File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
samples/mini-forms/app/controllers Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -22,13 +22,15 @@ object Comments extends Controller {
2222 " company" -> optional(text),
2323 " email" -> email,
2424 " phone" -> optional(text verifying jsPattern(""" [0-9.+]+""" , " constraint.phone" , " A valid phone number is required" )),
25- " message" -> nonEmptyText.verifying(jsConstraint(" constraint.nice_message" , " error.nice_message" ) { new { def eval (c : JS ) = { import c ._ ; (msg : Rep [String ]) => {
26- val words = msg.split(" " )
27- def countWords (regex : String ) = words.filter(regex.r.test(_)).length
28- val hateCount = countWords(" [Hh]ate|[Ss]uck" )
29- val loveCount = countWords(" [Ll]ove|[Rr]ock" )
30- hateCount < loveCount
31- }}}})
25+ " message" -> nonEmptyText.verifying(jsConstraint(" constraint.nice_message" , " error.nice_message" ) { new { def eval (c : JS ) = { import c ._ ;
26+ (msg : Rep [String ]) => {
27+ val words = msg.split(" " )
28+ def countWords (regex : String ) = words.filter(regex.r.test(_)).length
29+ val hateCount = countWords(" [Hh]ate|[Ss]uck" )
30+ val loveCount = countWords(" [Ll]ove|[Rr]ock" )
31+ hateCount < loveCount
32+ }
33+ }}})
3234 )(Comment .apply)(Comment .unapply)
3335 )
3436
You can’t perform that action at this time.
0 commit comments