473,657 Members | 2,594 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

checking for nothing entered in an asp form post

Hi,

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

lservice = request.form("p service")

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 2910
wk6pack wrote:
Hi,

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

lservice = request.form("p service")

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******** ******@TK2MSFTN GP10.phx.gbl...
: How do you check for a empty value from a form?
:
: lservice = request.form("p service")
:
: 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
1953
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. The intention is that if any of the two form fields are blank (empty) then the page is resent stating that they have to fill in all the fields to post (to a database). If I deliberately leave the fields blank and submit the form, querying the...
3
3231
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 approach to, once the user clicks the submit button to test the userid and password has been entered, and the text fields are not empty.
4
1882
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 from the list/menus they are passed on to a second page where he can check if all data are correct and then send it. DONE
5
3062
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 BeforeUpdate event of the first field, I check to see if that value has been previously entered. If it has, I do a Cancel = True and a Me.Undo. The number of records does not change and the new record button is still enabled although clicking it does...
2
2829
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 Contact_telephone___BeforeUpdate(Cancel As Integer) Dim rs As DAO.Recordset Dim iAns As Integer Set rs = Me.RecordsetClone rs.FindFirst " = '" & Me! & "'" If Not rs.NoMatch Then
4
2551
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 server database but the ODBC error tha tis returned is not very polite to the user since it mentions the sql field not the nice label. Is there a way for me to modify this error or put the check in access?
4
2343
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 required field of a drop down box I can't get it working -_- <html> <head> <style type="text/css"> .forgotten { border: 1px solid #ff0000;
2
1586
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 drop down box that is populated from a form "orders" in the DB, that works fine. but when i try and use an IF statement to see if the value entered in a text box is equal to the value in the database it comes up with the same result if its right or...
1
2003
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 even tried with echo also how to solve this the message should come under in the same window only see my code it is program ---- <?php // Connects to your Database mysql_connect('localhost', 'root', 'epara') or die(mysql_error());
0
8392
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8823
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1607
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.