I have an XPage control that I added validation to, adding a custom required validator type via script. This was working fine under 8.5, but the code’s validate function is not being triggered with 8.5.1.
My custom control is adding the validator using:
XSP.attachValidator(“#{id:response}”, new XSP.RequiredCheckValidator(“This is my message”));
XSP.RequiredCheckValidator is defined a client-side script library, as below:
XSP.RequiredCheckValidator = function RequiredValidator(message){
this.message = message;
this.validate = function xrv_v(clientId,value){
//radio buttons & checkbox return undefined as value because id is ascribed to HTML table element
//So do a dojo query returning an array of all inputs with name=clientId
var elements = dojo.query("input[name=" + clientId + "]");
var output = "";
//Loop through the array and get the first selected value. For validation we just need to confirm
//one value was selected
for (i=0; i < elements.length; i++) {if (elements[i].checked) {output = elements[i].value; break;}}
if (output=="") {
XSP.validationError(clientId,this.message);
return false;
}
return true;
}
}
By adding an alert statement in, I have confirmed that the validator is getting attached, but the validate function is not being used.
If anyone has any ideas, I would be very grateful. You can access the download database and a link to a live example by following this link: http://hermes.intec.co.uk/Intec/Blog.nsf/dx/15102009140044HERHA2.htm
Thanks
Paul