Reputation: 833
I want to use HTML5 form validations like 'required', in struts2 UI tag . I also have checked struts2 core jar file which shows that dynamic attribute is true for s:textbox. but if i use like <S:textbox name="username" required>
, it is throwing error.
Please help
Upvotes: 1
Views: 1370
Reputation: 1
This is the only way I have made it work in IE FF and Chrome
<input type="text" name="u.lName" required value='<s:property value="u.lName"'/>'/>
Upvotes: 0
Reputation: 537
Try like this:
<s:textbox name="username" required="required" />
Works perfectly in my case.
You can also use other html5 attributes in a similar way. eg. placeholder="placeholder value" , etc.
Upvotes: 1
Reputation: 10458
The attributes must have a value. So required will not work but required="" will not cause an issue.
Upvotes: 0