I am new to jquery. I could get validation rules valid on my form. I use the Java framework and for some reason, when it is converted from .xhtml to .html, all id / name of the ui component has a prefix of the form that contains it. I would like to reuse these validation rules for the other two forms, but due to a prefix problem, I will need to use the js variable and pass the formId to the function. For some reason this creates a problem for me:
DOES NOT WORK
var positionTitle = "#myForm:positionTitle";
$("#" + formId).validate({
rules:{
positionTitle : {required:true, maxlength:50},
...
WORKING
$("#" + formId).validate({
rules:{
"#myForm:positionTitle" : {required:true, maxlength:50},
...
source
share