views:

44

answers:

1

How i can check if user has input null/empty string in classic-asp? Right now i am doing this.

If Request.Form("productId") == "" Then
'my code here
End If

But its not working.

+2  A: 

Classic ASP/VBScript uses one = to check for equality, not two. Another thing you may want to try is

If Request.Form("productid") = "" Then
   Code here
End If
Anthony Pegram
Thanks look like its working. If you can give little more help. What is operator for != in classic asp?
itsaboutcode
That would be <>
Anthony Pegram
Thanks Anthony.
itsaboutcode
Except that Request.Form("productid") will NEVER be an object, so the test for "Is Nothing" can NEVER be true. If there is no value passed, simply testing against an empty string is sufficient.
BradBrening
@Brad, Thanks for the info, it has been a while since I've done classic ASP beyond trivial maintenance. Removed that check from answer.
Anthony Pegram