473,379 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

javascript form validaion won't post to asp page

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
3 3230

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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.