Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Testing for the exsistance of a FORM object 1

Status
Not open for further replies.

Triton001

Programmer
Jan 17, 2002
8
US
Hi everyone,

Will someone be able to shed some light on how I can test for the exsistance of a form object. Here is what I'm trying. I create a form based on a database record set so the form is being created dynamically. So, I can have 1 to many form elements. I name all the form elements with a unique name as it is being created so I can try to access each one.

Do you know a way to identify a form element before testing it. If I run the following code to test if its true and it does not exsist I get the error telling me it doesn't exsist. obviously I don't want the error just but I do want to know if there is no object.

if (document.order.extTot5.name == true)
{
Do something;
}

I need to test for the exsistance of the input box and if it is there do something if not just skip.

Any Ideas.

Mike
 
if (document.order.extTot5) {
alert("it exists!")
}

p.s. i am assuming here that "extTot5" is a name of your form field. --------------------------------------------------
Goals are dreams with deadlines
 
Excellent, So simple sometimes I just don't see it.

Thank you very much
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top