D
Data Guy
In my approach to validation for widgets, i write javascript functions.
At the end of the document, inside the form, i invoke the function as
<FORM NAME="testit">
<INPUT TYPE="TEXT" VALUE="2" NAME="_widge1">
<INPUT TYPE="BUTTON" VALUE="Edit" onclick="valfunc(this.form);">
</FORM>
where
function valfunc(f) {
if (f._widge1.value == 2) {alert("A 2!");}
}
Sometimes, oddly, the javascript cannot find _widge1. In such cases, I
must rewrite the function as
function valfunc(f) {
if (document.testit._widge1.value == 2) {alert("A 2!");}
}
This is clearly a little less general, as it only applies to one group
of forms, those with the name testit.
Why does this problem occur? Is there some rule about when I can pass
along that form as "this.form"?
At the end of the document, inside the form, i invoke the function as
<FORM NAME="testit">
<INPUT TYPE="TEXT" VALUE="2" NAME="_widge1">
<INPUT TYPE="BUTTON" VALUE="Edit" onclick="valfunc(this.form);">
</FORM>
where
function valfunc(f) {
if (f._widge1.value == 2) {alert("A 2!");}
}
Sometimes, oddly, the javascript cannot find _widge1. In such cases, I
must rewrite the function as
function valfunc(f) {
if (document.testit._widge1.value == 2) {alert("A 2!");}
}
This is clearly a little less general, as it only applies to one group
of forms, those with the name testit.
Why does this problem occur? Is there some rule about when I can pass
along that form as "this.form"?