If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Server side empty field validation

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-22-04, 17:02
Panavision Panavision is offline
Registered User
 
Join Date: Jan 2003
Posts: 15
Server side empty field validation

I have form page, which is used to update a database.

I want to validate the data, and rather do it on the server.

If there's a blank field then add I want to add something like error=1 to a querystring; if there are 2 errors, then only add 2 error variables to the querystring; if there are 3, add 3 to the querystring:

response.redirect
update?error=1&error=2&error=3&session(idvalue)=wh atever

This will enable me to highlight each field which requires data on the form page

I have to do this way 'cos if the user keeps missing a form field then at least they don't start from scratch i.e. all form fields empty.

started working on the code:

Code:
const numFields = 5
dim errorArray()
redim errorArray("error"+numfields)

FOR EACH field in request.form

IF Len(request.form(field)) = 0 THEN
%>
<a href = "update_record.asp?<%errorArray&idvalue="& Session("idvalue")%>">click here</a>

<%END IF
NEXT
Any ideas?
Reply With Quote
  #2 (permalink)  
Old 04-22-04, 19:44
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
Since you are already using the session object why not store your errors in there rather then passing them around??
Reply With Quote
  #3 (permalink)  
Old 04-26-04, 02:34
Bullschmidt Bullschmidt is offline
Guru
 
Join Date: Jun 2003
Location: USA
Posts: 1,032
Or instead of redirecting with a querystring you may want to post the page to itself:

ASP Design Tips - Post Back Page
http://www.bullschmidt.com/devtip-postbackpage.asp

Otherwise you might want to add every field to the querysting so that the user doesn't have to start from scratch (but what a pain).
__________________
J. Paul Schmidt, Freelance Web and Database Developer
www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On