You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Emond Papegaaij <em...@topicus.nl> on 2008/11/10 17:08:14 UTC

setRequired on CheckBox

Hello all,

During the development of a (somewhat) generic form component, I stumbled on 
the following error:
FormComponent can't be not required when the type is primitive class: 
[MarkupContainer [Component id = formField, page = <No Page>, path = 
formField.CheckBox]]

This is caused by calling setType(Boolean.TYPE) and setRequired(false) on a 
CheckBox component. setRequired checks if the type is a primitive and throws 
an exception when an attempt is made to make the component not required for a 
primitive. Although I think this is a good thing for most components, I don't 
think this behaviour can be applied on a CheckBox, because of the (slightly) 
different interpretation of required on a CheckBox (WICKET-1221). Perhaps 
CheckBox should override setRequired to not throw the Exception? Right now, I 
am required to always check a CheckBox when I set the type to Boolean.TYPE.

Best regards,
Emond Papegaaij

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org