Kobold
01-07-2004, 02:05 PM
Hello,
I am trying to create a simple form validation check where the name of the form is passed as an argument to a validation function using an onclick event.
The function is placed on a page which creates several dynamic forms with dynamic names.
function checkuserprice(formname) {
if (eval(document.formname.extravagant.value == "")) {
window.alert("Please insert a price for the extravagant option.");
document.formname.extravagant.focus();
return false;}
return true;
}
The function returns a "null or not an object" error. The problem is that "document.formname.extravagant.value" is not being evaluated and I was wondering why not?
I have hard coded a form name into the function and it has worked as it should
Cheers for any help.
Andrew
I am trying to create a simple form validation check where the name of the form is passed as an argument to a validation function using an onclick event.
The function is placed on a page which creates several dynamic forms with dynamic names.
function checkuserprice(formname) {
if (eval(document.formname.extravagant.value == "")) {
window.alert("Please insert a price for the extravagant option.");
document.formname.extravagant.focus();
return false;}
return true;
}
The function returns a "null or not an object" error. The problem is that "document.formname.extravagant.value" is not being evaluated and I was wondering why not?
I have hard coded a form name into the function and it has worked as it should
Cheers for any help.
Andrew