Hendy Irawan created WICKET-5289:
------------------------------------
Summary: setRequired(true) should add the HTML5 "required"
attribute
Key: WICKET-5289
URL: https://issues.apache.org/jira/browse/WICKET-5289
Project: Wicket
Issue Type: Improvement
Components: wicket
Affects Versions: 6.9.1
Reporter: Hendy Irawan
calling {{setRequired(true);}} only activates Wicket's own required validation.
It should also set "required" attribute supported by HTML5 browsers so
client-side UI experience will also match.
Example:
{code}
<form class="form form-horizontal" wicket:id="form">
<div class="control-group">
<label class="control-label" wicket:for="startDateFld">Start
date</label>
<div class="controls">
<input type="date" wicket:id="startDateFld"
style="margin-right: 10px" required/>
</div>
</div>
<div class="control-group">
<label class="control-label" wicket:for="endDateFld">End
date</label>
<div class="controls">
<input type="date" wicket:id="endDateFld"
style="margin-right: 10px"/>
</div>
</div>
</form>
{code}
{code}
final String datePattern = "yyyy-MM-dd";
startDateFld = new DateTextField("startDateFld",
startDateModel, datePattern) {
@Override
protected String getInputType() {
return "date";
};
};
startDateFld.setRequired(true);
// buggy inside Modal
// final DatePicker dateStartPicker = new DatePicker();
// dateStartPicker.setShowOnFieldClick(true);
// dateStartPicker.setAutoHide(true);
// startDateFld.add(dateStartPicker);
form.add(startDateFld);
final DateTextField endDateFld = new
DateTextField("endDateFld", endDateModel, datePattern) {
@Override
protected String getInputType() {
return "date";
};
};
endDateFld.setRequired(true);
{code}
startDateFld with "required" added manually is rendered correctly by Chrome.
the endDateFld has a clear button, which is incorrect, because the field is
required.
http://img841.imageshack.us/i/ydv0.png/
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira