Saturday, February 23, 2008


To tell Metawidget's Inspectors we don't want a label on a field, ideally we'd like to do...

@UiLabel( "" )


<property name="foo" label="">

Unfortunately, according to the DOM Element.getAttribute specification, it does not distinguish between 'an attribute having no value (eg. foo="")' and 'an attribute not existing'. In both cases getAttribute returns an empty String.

So to be able to specify an empty String without it just being ignored as a non-existant attribute, we need to put a String with a space...

@UiLabel( " " )


<property name="foo" label=" ">

...which is a bit sucky I know.

Suggested improvements welcome :)

Update: After playing around with label="null" for a bit, I noticed DOM supplies an Element.hasAttribute method for this purpose, so you can differentiate after all.


Mark Ashworth said...


<property name="foo" label="NULL" />