On Wed, Dec 8, 2010 at 5:37 PM, Jeremy Thomerson
<[email protected]>wrote:

> 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.
>
> instanctiationlistener will not work because the markup is not available
yet at construction time of FormComponent
I like the idea with markupsettings

using getFlag() to check those two (required and enabled) will not work too
because the method returns boolean, there is no "unknown/unset" state

And I *don't* like the idea of Wicket JSP thingie. We can use the markup to
facilitate the configuration (i.e. save some boilerplate in .java) but not
for any logic

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

Reply via email to