473,320 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

checking for nothing entered in an asp form post

Hi,

How do you check for a empty value from a form?

lservice = request.form("pservice")

if not isnull(lservice) then <== this doesnt work.
tried "" empty string and it still didnt work.
......

I'm having problems with the fact the user didnt enter anything. The field
is optional.

thanks,
Will
Jul 22 '05 #1
3 2869
wk6pack wrote:
Hi,

How do you check for a empty value from a form?

lservice = request.form("pservice")

if not isnull(lservice) then <== this doesnt work.
tried "" empty string and it still didnt work.
.....

I'm having problems with the fact the user didnt enter anything. The
field is optional.

thanks,
Will


form and querystring variables contain strings, so just check the number of
characters:

if len(lservice) > 0 then
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 22 '05 #2
"wk6pack" wrote in message news:u5**************@TK2MSFTNGP10.phx.gbl...
: How do you check for a empty value from a form?
:
: lservice = request.form("pservice")
:
: if not isnull(lservice) then <== this doesnt work.
: tried "" empty string and it still didnt work.
: .....
:
: I'm having problems with the fact the user didnt enter anything. The
field
: is optional.

This works also:

if lserver <> "" then
' value present
else
' no value present
end if

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #3
And here are some server-side validation links:

Server-Side Form Validation by Dianna Leech - 12/1/1999
http://www.4guysfromrolla.com/webtech/120199-1.shtml

An Email Validation Routine by João Vieira - 4/11/1999
http://www.4guysfromrolla.com/webtech/041199-1.shtml
Somewhat shorter.

An Email Validation Script by Ben Durbin - 5/19/1999
http://www.4guysfromrolla.com/webtech/051999-1.shtml
Longer.

Form Handler: Some light form validation and error notification.
http://www.asp101.com/samples/form_handler.asp
Uses function to loop thru all fields in a form.

And some client-side ones:

Javascript Field Validations -- Client Side Scripting by Nannette
Thacker - 8/19/1999
http://www.shiningstar.net/articles/...vascriptvalida
tions.asp?ID=AW

Form Validation Using Javascript - 9/19/1998
http://www.4guysfromrolla.com/webtech/091998-1.shtml
Good tips such as saving JavaScript functions in a file called
DataValidation.js and including this in pages that need this.
JavaScript functions.

WebDaily: Your daily source for Web Technology Tips and Tricks! -
10/27/1998
http://www.4guysfromrolla.com/webtech/102798-1.shtml
Just checks if fields filled in.

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
*** Sent via Developersdex http://www.developersdex.com ***
Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dariusz | last post by:
I have a small form that on button press submits to a PHP file for further processing into a database. I have to change the script as it allows blank / nothing to be submitted to the database. ...
3
by: Antoni | last post by:
Hello I wondered if this script seemed correct? The user should enter a userid and password in two text fields, and then pass these values to the method login_user. Could I ask, is there any...
4
by: johnny | last post by:
hi all, I am getting lost in showing data entered in a form to a confirm page. I have a form with as many list/menu as the categories existing in the database. DONE when user choose the items...
5
by: Sue | last post by:
As soon as a character is entered in the first field of a new record, the number of records shown in the navigation buttons increases by 1 and the new record button becomes enabled. In the...
2
by: R Bolling | last post by:
I am using a routine to check to see if a phone number (PK) has alread been entered, and takes the user to that record if it is found -- as follows: Private Sub...
4
by: Rich | last post by:
I have a access form that is connected to linked sql table via odbc. I have some fields that I dont want to allow nulls when data is entered via the form. I can set the null checking on the SQL...
4
by: reinhout | last post by:
Hi everyone, I have made a script that checks if content is entered in the html boxes and if the required fields are empty, their border lights red. This all works, but if I try to make a...
2
by: metalheadstorm | last post by:
Ok this is my first post, gtz me ^^ well i have a DB im making for a project and im using a Vb interface and a access db linking them togethering using ADO. on one SStab / form i have a...
1
by: geetamadhavi | last post by:
Hi All, I have developed a php applciaiton where a new window is opening on checking the whether valid user orntot how to make that in same window after checking i have die(' not valid user ' ); i...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.