Reputation: 579
I have a password field that is on some pages and not on some pages. This is legacy code and it uses one include page for logic on both types of pages. I need to check if that control exists. I can't seem to find a way to check using vbscript.
some pages have
<label>Enter Password:</label> <input type="password" name="pwd" id="pwd"/><br/>
some do not
Using ASP how do I check if it exists?
if (?????) then
end if
Upvotes: 1
Views: 986
Reputation: 603
Not real sure if you are running on the server or on the client. So I'll take a stab its on the client. This might work for you.
if ( TypeName(document.getElementById("pwd")) ) <> "Nothing" then
MsgBox("found!")
else
MsgBox("not found!")
end if
Update:
Since this is server side, and vbscript is pretty long in the tooth, I dimly remember this working for me:
if isEmpty(Request.Form("pwd")) then
//-- not there...
else
//-- its there ....
end if
Upvotes: 3
Reputation: 114377
Server-side ASP:
if request("pwd") <> "" then
end if
Upvotes: 0