I am trying to determine which form in my webpage an object belongs to after passing its full location into the function.
In the following example I pass wc.wcUser to the function and alert if it belongs to wcForm (or at least thats what I want to do)
So if I call wcIsNull(document.wcForm.wcUser,'bleh'); I can tell that the parent form is document.wcForm .. that way I can pass information from other forms into the function and not have that part processed.
If you need any more explanation just ask, I find it hard to explain exactly what I am trying to do here
<SCRIPT LANGUAGE="Javascript">
function wcIsNull(itmForm,msgAlert) {
if (itmForm.value == '') {
alert(msgAlert);
alert((itmForm.??????? == document.wcForm) ? 'it is' : 'it is not');
itmForm.focus();
}
}
</SCRIPT>
<form name="wcForm" onsubmit="wc = document.wcForm; wcIsNull(wc.wcUser,'Please enter a username.'); return false">
<input type="text" name="wcUser" value="">
<input type="submit">
</form>
In the following example I pass wc.wcUser to the function and alert if it belongs to wcForm (or at least thats what I want to do)
So if I call wcIsNull(document.wcForm.wcUser,'bleh'); I can tell that the parent form is document.wcForm .. that way I can pass information from other forms into the function and not have that part processed.
If you need any more explanation just ask, I find it hard to explain exactly what I am trying to do here
<SCRIPT LANGUAGE="Javascript">
function wcIsNull(itmForm,msgAlert) {
if (itmForm.value == '') {
alert(msgAlert);
alert((itmForm.??????? == document.wcForm) ? 'it is' : 'it is not');
itmForm.focus();
}
}
</SCRIPT>
<form name="wcForm" onsubmit="wc = document.wcForm; wcIsNull(wc.wcUser,'Please enter a username.'); return false">
<input type="text" name="wcUser" value="">
<input type="submit">
</form>