mariluzrm
Member
Hello.
In a dropdown element of a repeat group I am including javascrip code to hide / show other elements of the same group. I have first included code in the "load event" and it works, but in the "change event" it doesn't work (I can't even see it with the browser debugger). Why doesn't it work at the "event change"?
The code is:
var sel = this.getValue();
var repeat = this.getRepeatNum();
var field1 = this.form.formElements.get('componte___MACIZOEX_'+repeat);
var field2 = this.form.formElements.get('componte___CAR_TIR_'+repeat);
var field3 = this.form.formElements.get('componte___NLINCENT_'+repeat);
var field4 = this.form.formElements.get('componte___NLINDCHO_'+repeat);
var field5 = this.form.formElements.get('componte___NLINIZQ_'+repeat);
var field6 = this.form.formElements.get('componte___NCABCENT_'+repeat);
var field7 = this.form.formElements.get('componte___NCABDCHO_'+repeat);
var field8 = this.form.formElements.get('componte___NCABIZQ_'+repeat);
var field9 = this.form.formElements.get('componte___TIPOHAST_'+repeat);
var field10 = this.form.formElements.get('componte___LUZ_'+repeat);
var field11 = this.form.formElements.get('componte___CANTOMAX_'+repeat);
var field12 = this.form.formElements.get('componte___CANTOMIN_'+repeat);
if (sel!=="1" && sel!=="0"){
field10.hide();
field11.hide();
field12.hide();
}
if (sel!=="5" && sel!=="0"){
field1.hide();
field2.hide();
field3.hide();
field4.hide();
field5.hide();
field6.hide();
field7.hide();
field8.hide();
}
if (sel!=="8" && sel!=="0"){
field9.hide();
}
Also, on some occasions, I change javascript code and it does not update it (I do not see it updated in the browser debugger either). I have tried to clear the browsing history in Chrome and sometimes it updates and sometimes not. Why?
Thanks!!!
In a dropdown element of a repeat group I am including javascrip code to hide / show other elements of the same group. I have first included code in the "load event" and it works, but in the "change event" it doesn't work (I can't even see it with the browser debugger). Why doesn't it work at the "event change"?
The code is:
var sel = this.getValue();
var repeat = this.getRepeatNum();
var field1 = this.form.formElements.get('componte___MACIZOEX_'+repeat);
var field2 = this.form.formElements.get('componte___CAR_TIR_'+repeat);
var field3 = this.form.formElements.get('componte___NLINCENT_'+repeat);
var field4 = this.form.formElements.get('componte___NLINDCHO_'+repeat);
var field5 = this.form.formElements.get('componte___NLINIZQ_'+repeat);
var field6 = this.form.formElements.get('componte___NCABCENT_'+repeat);
var field7 = this.form.formElements.get('componte___NCABDCHO_'+repeat);
var field8 = this.form.formElements.get('componte___NCABIZQ_'+repeat);
var field9 = this.form.formElements.get('componte___TIPOHAST_'+repeat);
var field10 = this.form.formElements.get('componte___LUZ_'+repeat);
var field11 = this.form.formElements.get('componte___CANTOMAX_'+repeat);
var field12 = this.form.formElements.get('componte___CANTOMIN_'+repeat);
if (sel!=="1" && sel!=="0"){
field10.hide();
field11.hide();
field12.hide();
}
if (sel!=="5" && sel!=="0"){
field1.hide();
field2.hide();
field3.hide();
field4.hide();
field5.hide();
field6.hide();
field7.hide();
field8.hide();
}
if (sel!=="8" && sel!=="0"){
field9.hide();
}
Also, on some occasions, I change javascript code and it does not update it (I do not see it updated in the browser debugger either). I have tried to clear the browsing history in Chrome and sometimes it updates and sometimes not. Why?
Thanks!!!