Link to home
Start Free TrialLog in
Avatar of williamsF1
williamsF1

asked on

Check if Element Exists problem...if in Array or NOT

There's a web page that querys a list of names, and returns the Name corresponding IDNo.
The IDno is in a Hidden Field.
If there is an array [query returns more than 1 name and 1 IDNo] I have no problem:
var exists = eval(document.form.hidden[i].value)
window.alert (exists)     //object
if(exists) {window.alert ("true")} else {window.alert ("false")}

The problem is when there is only one Name returned from the query hence No array, the above returns an error [Object doesnot support....] and I have to do this:
var exists = eval(document.form.hidden.value)


ASKER CERTIFIED SOLUTION
Avatar of archrajan
archrajan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of williamsF1
williamsF1

ASKER

wow, I must be on something.....I thought I tried that?!
Thank for your help archrajan!
U r welcome anytime.. thanks for the points!