In order to perform server-side validations on a radio group/checkbox group I had to write client-side JavaScript that copies the selected values from the radio/checkbox into a hidden inputbox field (which had to be hidden via css) and then set up server-side validation for the hidden inputbox plus then connect both the radio group/checkbox group to the same data field in the data source. Ugh!
In order to validate a select object I needed to use a validateExpression validator.
There must be an easier way to do this.
Anybody else have easier ways to server-side validate these kinds of fields? Please? Pretty please?
Second, thanks for your blog. I have found several of your XPages postings to be very helpful.
Third, we both ended up using validators for the select but I like your solution better.
Finally,I guess “works” means different things to different folks. You are correct that you will get the standard “Validation Error: Value is required” message by simply working with the properties but that is not a viable solution long term. “Works” to me means the message is customized.
Sorry, I guess I misunderstood. So the issue is that you want to customize the error message from a checkbox/radiobutton group?
If that’s the case, I thought you could just add a “validateRequired” validator and add your custom message there…but I could not get that to work for me either.
…I found another thread and Paul Hannan indicated that this is a bug impacting other controls and he stated that all controls should have the same functionality for validation messages.
Server or DDE? because I’m running 8.5.2 DDE and 8.5.1 server and no validation works for combo boxes AT ALL, and radio buttons don’t get the customized message, but at least do work. Any additional info out there??
Are you just checking if they user selected a value? If so, I just set the “required” property to true. Then link a “Display Error” control to the checkbox group or radio button group.
The only control that this did not work for me is a combobox where I set the default value to “-Select-”. Then I needed to use a validateconstraint validator and a regular expression “^(?!.-Select-)[-a-zA-Z\d .,/]$”
Here’s that code:
<xp:this.validators>
<xp:validateConstraint
message="Validation Error: Value is required.">
<xp:this.regex><![CDATA[^(?!.*-Select-)[-a-zA-Z\d .,/]*$]]></xp:this.regex>
</xp:validateConstraint>
</xp:this.validators>