After changing the class validation is not working

Maxweell 28 Feb, 2013
Hello.
After changing the class validation is not working.

<select onchange=\"{var chname=document.getElementsByName('ed_{$i}')[0]; 
 var cname=document.getElementsByName('input_text_{$n}')[0];

var valid=this.options[selectedIndex].getAttribute('valid');

if(valid==10000){
    valid='validate[\'%checkPe\']';
}
if(valid==20000){
    valid='validate[%checkRaps]';
}
if(valid==5000){
    valid='validate[\'%checkSoya\']';
}
if(valid==50000){
    valid='validate[\'%checkKart\']';
}
if(valid==100000){
    valid='validate[\'%checkPshen\']';
}
if(valid==''){
    delete valid;
}
if(valid){
cname.className = valid;
}
else{
cname.setAttribute('class', '');
}
chname.value=this.options[selectedIndex].title+'.'}\" 
size=\"1\" id=\"input_select_{$a}\" class=\" validate['select']\" title=\"input_select_{$a}\" name=\"input_select_{$a}\">


<input maxlength='150' size='30' class=\"validate['%checkPe']\" title='' type='text' value='' name='input_text_{$n}' />



This code dynamically changing class for validation, but the validation does not change. How to fix it?
Thank you.
GreyHead 01 Mar, 2013
Hi Maxweell,

Changing the class will not change the validation. The class is used to set up the validation when the form loads; changes to the classes after that have no effect unless you reinitialise the validation.

You can use the FormCheck register() and dispose() methods to change validations like this.

Bob
This topic is locked and no more replies can be posted.