Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
</script>
</head><body>
<form wicket:id="form" id="form1" method="post" action="./page?0-1.-form"><div id="form1_hf_0" hidden="" class="hidden-fields"></div>
<input type="text" wicket:id="txt1" value="foo" name="txt1"/>
<input type="text" wicket:id="txt2" value="bar" name="txt2"/>
<input type="text" wicket:id="txt1" value="foo" name="txt1" required="required"/>
<input type="text" wicket:id="txt2" value="bar" name="txt2" required="required"/>
<input type="submit" value="Submit" wicket:id="submit" name="p::submit" id="submit2"/>
</form>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<form wicket:id="form" id="form9" method="post" action="./org.apache.wicket.markup.html.form.validation.HomePage1?1-1.-bug-form"><div id="form9_hf_0" hidden="" class="hidden-fields"></div>
<div wicket:id="border"><wicket:border>
<wicket:body>
<input wicket:id="name" value="" name="border:border_body:name"/>
<input wicket:id="name" value="" name="border:border_body:name" required="required"/>
<div wicket:id="feedback"><wicket:panel>

</wicket:panel></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1409,6 +1409,11 @@ protected void onComponentTag(final ComponentTag tag)
onDisabled(tag);
}

if (isRequired())
{
onRequired(tag);
}

super.onComponentTag(tag);
}

Expand All @@ -1424,6 +1429,19 @@ protected void onDetach()
convertedInput = null;
}

/**
* Called by {@link #onComponentTag(ComponentTag)} when the component is required. By default,
* this method will add a required="required" attribute to the tag. Components may override this
* method to tweak the tag as they think is fit.
*
* @param tag
* the tag that is being rendered
*/
protected void onRequired(final ComponentTag tag)
{
tag.put("required", "required");
}

/**
* Called by {@link #onComponentTag(ComponentTag)} when the component is disabled. By default,
* this method will add a disabled="disabled" attribute to the tag. Components may override this
Expand Down
Loading