In HTML 5 it is possible to use attributes like required, autocomplete
etc. Currently Wicket ignores such attributes and does not parse them
into anything meaningful, except IIRC the markup id.
What we could do is the following:
public class TextField ... {
@Override
protected void onInitialize()
{
super.onInitialize();
setRequired(getMarkupAttributes().containsKey("required")));
setEnabled(getMarkupAttributes().containsKey("enabled")));
}
}
By doing this in onInitialize() we don't override anything done in
onConfigure, but we would negate anything set on the component prior
to it being added to the page. For example:
TextField tf = new TextField( ... );
tf.setRequired(false);
add(tf);
<input type="text" wicket:id="" required>
would ultimately result in a required field
Another thing is that if/when we allow this, the next thing folks want
is to make it conditional... and then we have Wicket JSPs...
So I'm not sure if it is a good idea to enable component configuration
from the markup.
Martijn