dreamweaver thread: validation of fields in a form!!!!
Hi leslie
Its been a while since I done web, so here we go
I am guessing you are getting user info from a listing of form elements
inside a form from an asp, then submitting these elements to an asp (could
be the same asp as before or different) for validation.
-first validate to see if you are actully catching the fields by your
vars, do something like response.write("new user name:" & newusername).
If you dont get anything, your cathing syntax may be your problem
to catch form fields in your second asp:
'---if action type is : post
newusername = Trim(request.form("newusername"))
'---if action type is : get
newusername = Trim(request.queryString("newusername")
Hope this helps...Peter Crane
> hi all,
> how do i validate fields in a form that is been filled by a
customer.
i> am new to dreamweaver and asp.
i> have written some code and each time i run it nothing happens. i
i> ntentionally leave some fields blank but i don't get any response from
t> he system telling me i need to fill those fields.
h> ere is my code
>
'> check for required fields
<> %
i> f objconn = server.CreateObject("ADODB.Connection")
o> bjConn. open "DSN="padda"
i> f objconn.Errors.count > 0 Then
s> et objError = server.CreateObject("ADODB.Error")
D> im blnCriticalError
n> ewusername = TRIM( Request( "newusername" ) )
n> ewpassword = TRIM( Request( "newpassword" ) )
e> mail = TRIM( Request( "email" ) )
s> treet = TRIM( Request( "street" ) )
c> ity = TRIM( Request( "city" ) )
c> ounty = TRIM( Request( "county" ) )
p> ostcode = TRIM( Request( "postcode" ) )
I> F newUser <> " " THEN
I> F newusername = " " THEN
> Response.Write " you did not enter your name!"
> END IF
I> F newpassword = " " THEN
> Response.Write " you did not enter your password!"
> END IF
I> F email = " " THEN
> Response.write " you did not enter your email!"
> END IF
I> F street = " " THEN
> Response.Write " you did not enter your street!"
> END IF
I> F city = " " THEN
> Response.Write " you did not enter your city!"
> END IF
I> F postcode = " " THEN
> Response.Write " you did not enter your postcode!"
> END IF
> IF usernameTaken( newUsername ) THEN
> Response.Write " The username you entered has already " &_
> "been chosen by a previous user. Please select " &_
> "a new username"
> END IF
%> >
> can someone PLEASE tell me what i am doing wrong?
t> hanks
l> eslie
|





