Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting null/empty input from user

Tags:

asp-classic

How can I check if the user has input a null or empty string in classic-asp? Right now I am have this code.

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

But its not working.

like image 712
itsaboutcode Avatar asked May 15 '10 02:05

itsaboutcode


People also ask

How do you check if input is null?

The IsNullOrEmpty() method returns true if the input is null . IsNullOrEmpty() returns true if the input is an empty string.

How do you know if its null or empty?

You can use the IsNullOrWhiteSpace method to test whether a string is null , its value is String. Empty, or it consists only of white-space characters.

How do you take an empty input in python?

Use blank=True if you'd like to make input optional so that the user doesn't need to enter anything.

How do I stop an empty input in python?

To prevent an empty user input: Use a while loop to iterate until the user enters a non-empty string. On each iteration, check if the user didn't enter an empty string. If the condition is met, break out of the while loop.


1 Answers

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
like image 154
Anthony Pegram Avatar answered Nov 14 '22 21:11

Anthony Pegram