Sorry - didn't realise you were using javascript validation (should have read your post more carefully).
You could add your own client side code: <script> function checkTheBox() { if (!document.forms['yourForm'].myCheckbox.checked) { alert("you must check the box to proceed"); return false; } else { return true; } } </script> <html:form action="/yourAction.do" onsubmit="return checkTheBox();"> <html:checkbox property="myCheckbox" value="true" /> </html:form> -----Original Message----- From: Morowitz, Michael [mailto:[EMAIL PROTECTED] Sent: 17 March 2004 17:14 To: Struts Users Mailing List Subject: RE: Single Checkbox Required But, when I mark it "required" in my validator.xml, it doesn't work. The javascript that is generated (validateRequired) does not apply to fields of type "checkbox". I suppose I could modify the javascript, but I want both server side and client-side validation. -M -----Original Message----- From: Brendan Richards [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 10:52 AM To: Struts Users Mailing List Subject: RE: Single Checkbox Required What makes a checkbox unusual is that it only submits a value when checked - when unchecked nothing is submitted. You should therefore be able to validate that it's been checked with a standard "required" validator. -----Original Message----- From: Morowitz, Michael [mailto:[EMAIL PROTECTED] Sent: 17 March 2004 16:26 To: [EMAIL PROTECTED] Subject: Single Checkbox Required I have searched the archive of the list and I came up empty. I want to use validator.xml to indicate that a single checkbox must be checked 'true' on my form. Has anyone had success simply indicating a boolean field to be "required"? I've noticed that in the client-side javascript that is generated, validateRequired does not look at fields of type 'checkbox'. I have read that commons-validator added this functionality at some point in the past, but has it not made it into the Struts validtion package? Thanks, Michael --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]