By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,877 Members | 1,102 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,877 IT Pros & Developers. It's quick & easy.

javascript form validaion won't post to asp page

P: n/a
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

Aug 8 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a

I see nothing wrong with the js, post the url of the page to see what's
not working.
Danny
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Aug 8 '05 #2

P: n/a
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?pa...ssword2=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.

Aug 8 '05 #3

P: n/a
ASM
ia****@gmail.com wrote:
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?pa...ssword2=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

--
Stephane Moriaux et son [moins] vieux Mac
Aug 11 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.