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)
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[
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
U r welcome anytime.. thanks for the points!
ASKER
Thank for your help archrajan!