p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

asp_databases thread: asp- form validation problem


Message #1 by <ritukamal@y...> on Sat, 8 Jul 2000 15:07:00 -0700
hello



I am facing one problem in a Form Validation. the form is having 15-20 

text boxes if u want to look

into the form visit http://web.domiandlx.com/aggrk/newuser.htm  this 

form is submitted to one ASP

program, that program is updaing Access DAtabase file using SQL Insert 

INTO statement and working

properly only if all the Text boxes are filled, in case I left anyof 

these then it gives error.



I want that there should be a small program or script that automatically 

checks for all the

request.form collection items for NULL or Blank or Empty and if anyone 

is left blank then assign

NUll/BlankSpace to it.



I am able to check and display appropriate Message to the user that this 

particular textfield is

left blank. i am using the following script for that but gives error 

when i assign blank space to it



*******

for each i in request.form

 if (len(trim(request.form(i)))>0 ) then

  response.write "<br>" & i  & " Left Blank"

  request.form(i) =3D " "  ' gives error in this line.

 else

  response.write "<br>" & i & " / " & request.form(i) 

 end if    

next



*******





pls. give me the solution for the above problem.





waiting for the reply.



RituKamal Aggarwal



email : ritukamal@y...

website : www.websamba.com/ritukamal

Message #2 by "Ken Schaefer" <ken.s@a...> on Mon, 10 Jul 2000 14:42:51 +1000
The Request.Form collection is read only...

so you can't do:



Request.Form(i) = " "



You need to assign all the Request.Form elements to variables (or put it

into an array) and then update the variables (or array elements)



Cheers

Ken



----- Original Message -----

From: "RituKamal Aggarwal" <ritukamal@y...>

To: "ASP Databases" <asp_databases@p...>

Sent: Sunday, July 09, 2000 8:07 AM

Subject: [asp_databases] asp- form validation problem








  Return to Index