On Wed, Dec 8, 2010 at 10:28 AM, Martijn Dashorst
<[email protected]> wrote:
> 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
>

Could we create an Html5AutoConfigurationBehavior that could be added
to components if people wanted to auto-configure their components from
markup?  We might even provide an icomponentinstantiationlistener to
automagically add this to all components for users.  Or, make it a
markup setting on the application.

-- 
Jeremy Thomerson
http://wickettraining.com
Need a CMS for Wicket?  Use Brix! http://brixcms.org

Reply via email to