473,729 Members | 2,401 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

javascript form validation - form action to another asp page

Hi

In my prototype asp page (with no javascript and no password
validation, I have a registration form with the following action:

<form name="form" method="post" action="RegDeta ils.asp">

This works fine, the form details are collected by RegDetails.asp

I am attempting to include javascript server side validation for the
pasword, which obviously requires password and password2 fields (to be
verified). I have used the script available at:

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

It works fine in a new blank page with the form action:

<form name=myForm onSubmit="retur n validatePwd()">

The final stage in this javascript demo form displays an alert box:

else {
alert('Nice job.');
return true;
When I change the first line of my original form to:

<form name=myForm onSubmit="retur n validatePwd()">

how do I get my original action of - action="RegDeta ils.asp" instead
of this alert box?

Thanks ColinK

Aug 7 '05 #1
10 6606
ia****@gmail.co m wrote:
The final stage in this javascript demo form displays an alert box:

else {
alert('Nice job.');
return true;
When I change the first line of my original form to:

<form name=myForm onSubmit="retur n validatePwd()">

how do I get my original action of - action="RegDeta ils.asp" instead
of this alert box?


What do you mean by "original action"?

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Aug 7 '05 #2
Hi Dave

Thanks for your interest.

My original form, without validation had the following original action:

<form name="myform" method="post" action="RegDeta ils.asp">

I modified my form from the one I got at:

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

<form name=myForm onSubmit="retur n validatePwd()">

So the action of the form now passes Pasword and Password2 to the
javascript for validation - BUT how do I then get my form fields to
pass to my other page RegDetails.asp ?

Thanks ColinK

Aug 7 '05 #3
Hi Dave

Thanks for your interest.

My original form, without validation had the following action:

<form name="myform" method="post" action="RegDeta ils.asp">

I modified my form from the one I got at:

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

<form name=myForm onSubmit="retur n validatePwd()">

The form now passes Password and Password2 to the
javascript for validation - BUT how do I then get my form fields to
pass to my other page RegDetails.asp ? ie to also do the following
action:

action="RegDeta ils.asp"

Aug 7 '05 #4
If you do not quote, I will not respond further.

ia****@gmail.co m wrote:
My original form, without validation had the following
original action:

<form name="myform" method="post" action="RegDeta ils.asp">

I modified my form from the one I got at:

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

<form name=myForm onSubmit="retur n validatePwd()">

So the action of the form now passes Pasword and Password2
to the javascript for validation - BUT how do I then get my
form fields to pass to my other page RegDetails.asp ?


Truth is, a FORM element is allowed to have both an ACTION attribute and an
ONSUBMIT attribute at the same time. I have no idea why you took the action
out in the first place. Put it back. Returning a value of [false] will
prevent the form submission. Example:

<form action="xxx.asp " onsubmit="retur n validate(this)" >
<input name="favoriteI ceCream">
</form>

function validate(f) {
if (f.favoriteIceC ream.value == "") return false
return true
}

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Aug 7 '05 #5
Hi
If you do not quote, I will not respond further


Thanks for your help.

The quote was copied manually.

Using google how do I reply and include the original message?

Thanks Colin

Aug 7 '05 #6
Hi Dave

Your message to me - I do not know how to copy with >

Truth is, a FORM element is allowed to have both an ACTION attribute
and an
ONSUBMIT attribute at the same time. I have no idea why you took the
action
out in the first place. Put it back. Returning a value of [false] will
prevent the form submission. Example:

<form action="xxx.asp " onsubmit="retur n validate(this)" >
<input name="favoriteI ceCream">
</form>
function validate(f) {
if (f.favoriteIceC ream.value == "") return false
return true
}

I do not have enough experience to use the above apart from
understanding
a FORM element is allowed to have both an ACTION attribute and an ONSUBMIT attribute at the same time.

But I cannot implement both at the same time

When I use either of the 2 form headers below, the passwords are
verified but the form fields are sent back to the same form as a
querystring added to the form page url - the form reopens blank.
From what you are saying, the second form header should post the form

fields to register.asp

<form name=myForm onSubmit="retur n validatePwd()">

<form name=myform method=post onSubmit="retur n validatePwd()"
action=RegDetai ls.asp>

My original form without the javascript has this header and posts OK.

<form name=form method=post action=RegDetai ls.asp>

Just as a reminder the javascript came from:
http://javascript.internet.com/forms/val-pass.html

Any further help would be appreciated

ColinK

Aug 7 '05 #7
Hi Dave
Thanks for your continued interest.

As per my previous post I still do not know how to copy with > - so the
follwoing is manually copied:

Truth is, a FORM element is allowed to have both an ACTION attribute
and an
ONSUBMIT attribute at the same time. I have no idea why you took the
action
out in the first place. Put it back. Returning a value of [false] will
prevent the form submission. Example:

<form action="xxx.asp " onsubmit="retur n validate(this)" >
<input name="favoriteI ceCream">
</form>
function validate(f) {
if (f.favoriteIceC ream.value == "") return false
return true
}

Hopefully the following will more accurately clarify the problem.
If I copy all of the script from:
<form name=myform method=post onSubmit="retur n validatePwd()"
action=RegDetai ls.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="retur n validatePwd()">
ALTERNATIVE1
<form name="myform" method="post" onSubmit="retur n validatePwd()"
action="RegDeta ils.asp">
ALTERNATIVE2
<form name=myform method=post onSubmit="retur n validatePwd()"
action=RegDetai ls.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 #8
Hi Dave

I still do not know how to copy the original post - so the following is
manually copied

Truth is, a FORM element is allowed to have both an ACTION attribute
and an
ONSUBMIT attribute at the same time. I have no idea why you took the
action
out in the first place. Put it back. Returning a value of [false] will
prevent the form submission. Example:

<form action="xxx.asp " onsubmit="retur n validate(this)" >
<input name="favoriteI ceCream">
</form>
function validate(f) {
if (f.favoriteIceC ream.value == "") return false
return true
}

Hopefully the following will more accurately clarify the problem.
If I copy all of the script from:
http://javascript.internet.com/forms/val-pass.html

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="retur n validatePwd()">
ALTERNATIVE1
<form name="myform" method="post" onSubmit="retur n validatePwd()"
action="RegDeta ils.asp">
ALTERNATIVE2
<form name=myform method=post onSubmit="retur n validatePwd()"
action=RegDetai ls.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 #9
ia****@gmail.co m wrote:
I still do not know how to copy the original post - so
the following is manually copied
I don't really care if you know how. If you don't take the time to do it, I
won't take the time to respond. I suggest opening an actual NNTP client and
pointing directly to news.microsoft. com.
If I copy all of the script from:
http://javascript.internet.com/forms/val-pass.html

Into a new page, the validation works fine.
Nobody cares if you can copy an example and prove that it works as
advertised. Show your actual code. Leave out whatever is superfluous. The
HTML tag does not help me understand your problem. Nor do HEAD, TABLE, TD,
TR, B, FONT, or anything not part of your form. Leave them out of your
example.

Omit <SCRIPT> and </SCRIPT> when providing your javascript examples. It will
be obvious to us that your javascript resides in them.

Likewise, leave out the javascript comments. Those of us capable of helping
you are also capable of reading javascript at face value.

Alternatively, provide a URL to your actual page.
I want to be able to validate and post - but I can't do both

Thanks ColinK
ORIGINAL
<form name=myForm onSubmit="retur n validatePwd()">
ALTERNATIVE1
<form name="myform" method="post" onSubmit="retur n validatePwd()"
action="RegDeta ils.asp">
ALTERNATIVE2
<form name=myform method=post onSubmit="retur n validatePwd()"
action=RegDetai ls.asp>
My first piece of advice is to immediately break your habit of using
unquoted attribute values. If qoutes are causing you problems, you are DOING
SOMETHING WRONG. Don't compund the problem by removing the quotes. Find out
what you are doing wrong and stop doing it.
Note I have 2 alternatives as the javascript did not seem to
like the "" in some parts of my original page.


If you had posted your code, we might know how to help you.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Aug 9 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
21345
by: NotGiven | last post by:
I have a field called telephone whose ONBLUR action is to call a javascript function: validatePhoneNumber(telephone) The non-working function is: function validatePhoneNumber(v) { var phone =document.form. + v + .value; //HERE"S WHAT IS NOT WORKING
2
1355
by: francisco lopez | last post by:
Yesterday I had a problem with a javascript to validate my form, but you helped my out yesterday and it works now perfectly!!! so thank you!!! the problem I have now is the following: I put my form now on the server and I changed following lines: I changed: form action="mailto:fran@gmx.net"
2
2556
by: iam247 | last post by:
Hi In my prototype asp page (with no javascript and no password validation, I have a registration form with the following action: <form name="form" method="post" action="RegDetails.asp"> This works fine, the form details are collected by RegDetails.asp I am attempting to include javascript server side validation for the
3
3260
by: iam247 | last post by:
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
6
3138
by: bonehead | last post by:
Greetings, I'm working on an e-mail form (btw many thanks to Philip Ronan for the very cool email address format tester function, best I've seen so far). I've been trying, with limited success, to produce a javascript alert box which shows the user a validation error message. The error message itself is dynamic, i.e., it's contained within a php variable. I seem to be running into two issues:
5
2332
by: mouac01 | last post by:
I'm new to PHP/Javascript. I have a simple form I want to validate the fields with javascript and then run the PHP script. All the scripts are in one page. I want PHP to control where the next page is. It works fine without the javascript but when I add the javascript the page doesn't do anything besides the validation. Thanks for your help... Chong ----login.html-------------------------------- <?php ob_start();
27
4750
by: Chris | last post by:
Hi, I have a form for uploading documents and inserting the data into a mysql db. I would like to validate the form. I have tried a couple of Javascript form validation functions, but it appears that the data goes straight to the processing page, rather than the javascript seeing if data is missing and popping up an alert. I thought it may be because much of the form is populated with data from the db (lists, etc.), but when I leave...
3
2095
by: anthonybrough | last post by:
I have an asp page that has a form to collect user data in a form. when the user clicks submit the input is validated. If any fields are not acceptable the user clicks on a button to go back to the original form to correct the input. This all works fine until I try to incorporate a javascript to display a popup calendar which posts the selected date back to a field on the form. This script works fine in itself, however if the page is...
14
2187
by: Mtek | last post by:
Hi, We have a form defined with buttons like this: <a class="save_menu" href="javascript:document.Detail_Screen.action = 'savedata.php?screen=EDIT';document.Detail_Screen.submit();">Update</ a> The form also has an onSubmit action to vall a validation routine:
0
8763
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9148
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8151
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6022
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4528
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4796
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2683
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.