Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integrate Client-side Validation

EDIT
contacted the author of play-js-validation. Bleeding edge stuff; Play has to be compiled against scala virtualized on to-be-released 2.10, and nested case classes are not yet supported. Really impressive project, I hope it comes to fruition as the prototype does almost exactly what I was hoping for...

Found this: https://github.com/namin/play-js-validation

Anyone know if there are plans for built-in client-side validation in Play 2.0?

I am currently generating controller, model (with form validation), and dao scala files based on an existing DB schema; would love to include client-side validation as part of that process!

Thanks for clues, insider knowledge, etc.

p.s. Play user group is, to say the least, busy; most posts seem to be completely ignored (of course, many Stackoverflow Play-related questions go unanswered as well, so this thread may be DOA...)

like image 624
virtualeyes Avatar asked Nov 03 '22 23:11

virtualeyes


1 Answers

There's no such plans I'm afraid, at least didn't hear about (note: I'm not a dev team member, just Player)

Check tickets on Play's Lighthouse

On the other hand I doubt if this fits Play's assumptions at all. Client-side validation is done with some external JS solution which should not be determined by framework, nobody said that it should use ie. jQuery by default.

Finally, the only thing to use client-side validation is just to include the JS libs and add proper attributes to your form fields, ie it will create tag that you can validate with jQuery Validation plugin:

@inputText(entrantForm("identitynumber"),
    '_label->"Identity number",
    'class -> "required",
    'minlength -> "11",
    'maxlength -> "11")
like image 146
biesior Avatar answered Nov 09 '22 12:11

biesior