Answered
Create Javascript that runs for all form fields
I have a form that is about 200 text fields. Is there a way to use a general onblur / onfocus for all of them? adding the same javascript for all of them is a pain in the .......
I have a form that is about 200 text fields. Is there a way to use a general onblur / onfocus for all of them? adding the same javascript for all of them is a pain in the .......
Yes, that's possible, using this code:
for (var i=0; i<this.numFields; i++) {
var f = this.getField(this.getNthFieldName(i));
if (f==null) continue;
if (f.type=="text") {
f.setAction("OnFocus", " // enter on focus code here");
f.setAction("OnBlur", " // enter on blur code here");
}
}Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.