473,395 Members | 1,678 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,395 software developers and data experts.

Detecting Blank form field

www
Hi there,

I' m getting a (0x80040E2F) error, if I submit my form, with blank textboxes
to my update stored procedure. The stored procedure expect values, so how
can I detect if a form field was empty. I've tried testing to see if the
form field is null, blank and to count the characters, but I can't get it
working. My SQL table allows nulls, so it's not that.

thanks in advance
Charles
Jul 19 '05 #1
2 4225
www,

i assume you have:

CREATE .....
@a INT = NULL
AS
.......
<%
a = request.form("a")
........
if a<>"" then passthevalueAtoSP

%>

hope it makes sence :)

Best regards
/Lasse

"www" <ch*****@paltrack.co.za> wrote in message
news:3f**************@hades.is.co.za...
Hi there,

I' m getting a (0x80040E2F) error, if I submit my form, with blank textboxes to my update stored procedure. The stored procedure expect values, so how
can I detect if a form field was empty. I've tried testing to see if the
form field is null, blank and to count the characters, but I can't get it
working. My SQL table allows nulls, so it's not that.

thanks in advance
Charles

Jul 19 '05 #2
Whether you are submitting the page back to itself, or to
another page you could simply embed your submit within a
logic structure.

exp:

If Request.Form("form_field1") <> "" AND _
Request.Form("form_field1") <> "" Then
'submit the form
End If

However it's always a good practice to make sure all
values submitted to your database are in the correct
format and then submit.

exp:

b_submit_form = True

'I set all my variables first so I can reuse them later
'or alter them as needed.

d_date = Request.Form("form_field1")
i_value = Request.Form("form_field2")
s_comments = Request.Form("form_field3")

'In this example I want to confirm that the entered value
'is a date.

If IsDate(d_submit_date) = False Then
b_submit_form = False
'you can reset the variable back to blank if you
'refill the form later.
d_submit_date = ""
'you can also set an error message to display to the user
s_error = s_error & "A date must be a valid date. "
End If

'In this example I want to confirm that the entered value
'is a number.

If IsNumeric(i_submit_value) = False Then
b_submit_form = False
s_error = s_error & "FormField2 must be a numeric
value. "
End If

'In this example I want to confirm that the form field is
'not blank.
If s_comments = "" Then
b_submit_form = False
s_error = s_error & "FormField3 must be entered. "
End If

'Each form field Item would be checked to confirm proper
'values then we can submit the form

If b_submit_form Then
'submit the form
If Err.Description <> "" Then
s_return_message = "The following error occurred: " &
Err.Description
Else
s_return_message = "Thank you."
Else
s_return_message = s_error
End If

Of course everyone has there own ways of doing things,
this is just how I do it to make sure everything is in
order prior to submitting it to the database, and to let
the user know when there are problems.

Hope this helps,
- Dale

Jul 19 '05 #3

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

Similar topics

7
by: JDS | last post by:
Hi, all. I'd like to do the following, preferably *without* resorting to JavaScript: I have a long, dynamically-generated form questionnaire. Not all of the form fields are dynamically...
19
by: Gav | last post by:
Hi, At the moment i am checking that all the fields have been filled out, at the moment i am using the following... if firstname = "" and surname = "" and address1 = "" and town = "" and county...
1
by: Monte Chan | last post by:
Hi all, I have the following codes, <script language="JavaScript"> function check_stuff(field) { alert("blank out the field now"); field.value = ""; } </script>
19
by: Joe Scully | last post by:
Hi all, I am having trouble with access adding a blank record to a subform everytime I finish entering data and closing the form. (The form and subform are based on the one table) When...
5
by: ChadDiesel | last post by:
My basic question is why does my print report button on my subform print a blank report when my cursor is on a blank entry line? Here is a more detailed explanation of my problem. I have a...
0
by: visionstate | last post by:
Hi there, I have a form which has 2 text boxes, a combo box and a sub form in it (which reads from a query. The query reads from the table). On load, I would like the fields in the text boxes and...
4
by: sparks | last post by:
I am trying to fix a database that someone did about 4 yrs ago in access97. The main table just contains demographics and is on the main form of the database. It has a subform on a tab that...
1
by: gtwannabe | last post by:
I'm having a problem with a form that uses AutoNumber as the primary key. I have an Abort button to delete the current record and close the form. If AutoNumber is assigned, the code executes a...
5
by: M Skabialka | last post by:
I am creating my first Visual Studio project, an inventory database. I have created a form and used written directions to add data from a table to the form using table adapters, data sets, etc. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.