javascript form validaion won't post to asp page

I

iam247

Hi

I have an asp page without any javascript. It posts the content of a
form to another page, which reads the form fields using Request.Form.

This is the form header:

<form name=form method=post action=RegDetails.asp>

I have tried to modify the form by adding javascript for password
validation. The script came from:

http://javascript.internet.com/forms/val-pass.html

The form header from this javascript is:

<form name=myForm onSubmit="return validatePwd()">

This header validates my passwords ok but obviously is missing,
method=post & action=RegDetails.asp

When have combined the to form headers to give:

<form name=myform method=post onSubmit="return validatePwd()"
action=RegDetails.asp>

This header still validates the password but does not Post to
RegDetails.asp

On pressing submit the form fields are sent via the url as a
querystring, back to the same form/page which opens blank.

I would appreciate help in using the javascript to validate my form but
still Post the form values to RegDetails.asp

Thanks ColinK
 
I

iam247

Hi Danny
Thanks for your interest. Hopefully the following will more accurately
clarify the problem.

If I copy all of the script from:
<form name=myform method=post onSubmit="return validatePwd()"
action=RegDetails.asp>

Into a new page, the validation works fine. If the 2 passwords match
the final result is:
1. The "nice Job" alert pops up
2. A blank form reloads with the original url + the querystring of
Password 1& 2
eg
http://localhost/gc7/www/pass.asp?password=123456&password2=123456

If I remove the complete line for the last alert
alert('Nice job.');

Result 1 above obviously does not work but result 2 does.

The Problem

If I change the form header from the original to any of the 2
alternatives - shown at bottom (from my own original non validating
page) The form does not validate the passwords but post to
RegDetails.asp - same as my own original.

I want to be able to validate and post - but I can't do both

Thanks ColinK
ORIGINAL
<form name=myForm onSubmit="return validatePwd()">
ALTERNATIVE1
<form name="myform" method="post" onSubmit="return validatePwd()"
action="RegDetails.asp">
ALTERNATIVE2
<form name=myform method=post onSubmit="return validatePwd()"
action=RegDetails.asp>

Note I have 2 alternatives as the javascript did not seem to like the
"" in some parts of my original page.
 
A

ASM

If I copy all of the script from:

You have to copy-paste the whole JS script
You have to copy-past the 2 elements nammed 'password' and 'pasword2'
in the html code of your form

Your form must to be what you write here :
<form name=myform method=post onSubmit="return validatePwd()"
action=RegDetails.asp>

Into a new page, the validation works fine. If the 2 passwords match
the final result is:
1. The "nice Job" alert pops up

Yes
and ...
the form is submitted

that's to say : the page 'pass.asp' is called
2. A blank form reloads with the original url + the querystring of
Password 1& 2
eg
http://localhost/gc7/www/pass.asp?password=123456&password2=123456

exactly : it is what that has to do

-> your page 'pass.asp' has to treate one (or better : both) of the
two passwords given in end of url
It is to *you* to build your *asp program* in this page
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top