Do the Struts 2 expression
and/or fieldexpression
validators support automatically rendering client-side ECMAScript/JavaScript validation for the OGNL expression defined in the validation XML file, like what is done for the other bundled validators (requiredstring
, stringlength
, etc.)?
I ask, because the following ECMAScript is rendered for client-side for this form, and I don't see my OGNL expression anywhere. I've tried the expression
and fieldexpression
validators and they both render this:
function validateForm_dlgIdSearch_form() {
form = document.getElementById("dlgIdSearch_form");
clearErrorMessages(form);
clearErrorLabels(form);
var errors = false;
var continueValidation = true;
// field name: searchFilter.number
// validator name: fieldexpression
if (form.elements['searchFilter.number']) {
field = form.elements['searchFilter.number'];
var error = "Employee number is required.";
}
return !errors;
}
I am trying to require at least one of three search fields, and I'm not sure if I've made a mistake or if Struts 2's validation doesn't support automatic client-side ECMAScript generation for expression
and fieldexpression
validators.