Thanks for you input.
I gave this some more thought on my way home last night. When I think
about it - is a validator the right place to do this kind of business
logic (e.g. user has checked the box)? Shouldn't validators be all about
semantics like correct value range or format?
For a thing
Well, if you're going to be a purist, the proper thing would be to
create a drop-in component subclass of checkbox that only accepted
checked=true input. :-)
But that's overkill. The most simple reusable way to do this is to
create a validator. I have a project, which when eventually
converted
Hi Michael,
you are on the right track - the required==true flag will not help in
the case of the checkbox, as for checkboxes, JSF will _always_ set a
value (either true or false, due to the problems you mentioned above -
there is no way to distinguish between false and value not set at
all...).
The required=true flag means that the user *must supply a value*, but
doesn't ensure that they provide a specific value. With a checkbox, the
user *always* effectively provides a value: unchecked=false, checked=true.
So as Martin says, required=true is in fact pointless for checkboxes.
And his
Hi List,
now that I have spent several hours trying to figure it out on my own, I'm
giving this list a try.
What I want to do is rather basic: I want to have a mandatory checkbox in
my view. So if the user wants to continue working with the application he
must first tick the box.
So what I came
5 matches
Mail list logo