Skip to content
 
 

Repository files navigation

HTML5 Validation

The HTML5 validation module provides a drop-in replacement for HTML <input> elements called #{input /} which automatically adds HTML5 validation attributes to the final output based on your Play! model validation annotations.

Example

Suppose you have a Model class called User which has a field called name declared as

@Required
@MaxSize(8)
@Match(“[a-z]*”)
public String name;

you can replace your existing <input> element with the following:

#{input for:'user.name', id:'YourID', class:'class1 class2' /}

The tag will then output the following HTML code:

<input name="user.name" value="${user?.name}" id="YourID" class="class1 class2" required maxlength="8" pattern="[a-z]*">

About

Play! module for HTML5 validation of input tags

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors