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...).
what you can do instead is set the validator="#{myBb.validator}" attribute and validate in this method accordingly (or, as you said, write a new validator). regards, Martin On 2/27/08, Michael Heß <[EMAIL PROTECTED]> wrote: > 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 up with was to use the required="true" on the > h:selectBooleanCheckbox . Unfortunately this does not work. As I tried to > find out what goes wrong I gave h:inputText a try, and it worked as > expected, i.e. the form was considered invalid as long as the textbox was > empty. So something is fishy about the checkbox... > > OK, so I remember back from the struts days, that checkboxes are tricky > because they do not submit any value at all (not even an empty one) when > unchecked. Searching some more, I found a rather interesting discussion in > http://issues.apache.org/jira/browse/MYFACES-1467. Although the main > problem is about validators not running, the issue that required="true" > gets ignored in case the component does not create a http parameter at > all, is discussed at well. To the end of that issue it first seemed like a > patch was supplied, but then again several problems popped up, and someone > suspects that it's a spec issue.... frankly - i`m at a loss here. :-) > > So, what is the right approach for this behaviour? Create a > "MandatoryCheckboxValidator" and attach it to the checkboxes? Maybe > someone else had the problem already and can give me a hint how to > proceed? > > Thanks and bye, > Michael > > > -- > Michael Heß > Senior Consultant > > ORDIX AG > Westernmauer 12-16 > 33098 Paderborn > > http://www.ordix.de > Tel.: 05251 / 10 63 0 > Fax : 05251 / 10 63 99 > Mob : 0163 /673 49 43 > > ORDIX AG - Aktiengesellschaft für Softwareentwicklung, Schulung, Beratung > und Systemintegration > Vorsitzender des Aufsichtsrates: Prof. Dr. Hermann Johannes > Vorstand: Wolfgang Kögler (Vorsitzender), Benedikt Georgi, Christoph > Lafeld, Axel Röber > Firmensitz: Westernmauer 12 - 16, 33098 Paderborn, Tel: 05251 / 1063-0, > Fax: 0180 / 1 67 34 90 > Amtsgericht Paderborn, HRB 2941, Ust-IdNr.DE 126333767, Steuernummer: > 339/5866/0142 > > > -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces