473,395 Members | 1,678 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,395 software developers and data experts.

How do I redirect with a checkbox?

I have a form with a submit button. My idea was to have a checkbox.
In the validateform() right before the return true have it redirect to
another page if the checkbox was selected. I can't get the code to
work. Any suggestions?

Here's my code:

<FORM method="POST" ACTION="DoLogin.asp" name="This" onSubmit="return
validateForm()">
<input type="hidden" name="strNew" id="strNewPass" value="">
USERID:
<INPUT TYPE="text" NAME="strUser" VALUE="" SIZE="50" MAXLENGTH="50">
PASSWORD:
<INPUT TYPE="password" NAME="strPass" VALUE="" SIZE="50"
MAXLENGTH="50">
<input type="checkbox" name="ChgPassword">Change Password
</td>
</tr>
</table>
</FORM>

SCRIPT
If (eval("Document.This.ChgPassword.Checked == True"))
{
Response.Redirect("password.asp");
}
Thanks for your help.. I'm pretty new to this..

Jul 23 '05 #1
1 2355
"Sunshine" <su************@yahoo.com> skrev i meddelandet
news:11**********************@c13g2000cwb.googlegr oups.com...
I have a form with a submit button. My idea was to have a checkbox.
In the validateform() right before the return true have it redirect to
another page if the checkbox was selected. I can't get the code to
work. Any suggestions?

Here's my code:

<FORM method="POST" ACTION="DoLogin.asp" name="This" onSubmit="return
validateForm()">
<input type="hidden" name="strNew" id="strNewPass" value="">
USERID:
<INPUT TYPE="text" NAME="strUser" VALUE="" SIZE="50" MAXLENGTH="50">
PASSWORD:
<INPUT TYPE="password" NAME="strPass" VALUE="" SIZE="50"
MAXLENGTH="50">
<input type="checkbox" name="ChgPassword">Change Password
</td>
</tr>
</table>
</FORM>

SCRIPT
If (eval("Document.This.ChgPassword.Checked == True"))
{
Response.Redirect("password.asp");
}


if(document.forms["This"].ChgPassword.checked){

// do stuff
}

But naming any object "This" might not be a great idea.

Joakim Braun
Jul 23 '05 #2

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

Similar topics

1
by: Paul Oakfleet | last post by:
The script below will disable Submit button until user accept terms, and will redirect user to another page after clicking on Submit button. The script seems to work fine on my PC (Windows XP,...
9
by: dm4714 | last post by:
Hello - we have an ecommerce application that needs to come down for maintenance. The application is normally only accessed via http://www.mydomain.com/virtualdir/aspfile.asp. I'm using W2K...
4
by: Mr. x | last post by:
How can I redirect any error that occurs in an html page to a debugger. (For some reason, this option is disabled on my computer - I want to enable it again). Thanks :)
0
by: mike | last post by:
Hi there: I've read an excellent "how to"-article by Microsoft (no. 306227) - partly cited cited at the end of this email). I have implemented the code related to the part "How to Add a...
5
by: DotNetJunkies User | last post by:
1. i want to populate checkboxlist using javascript only at client side ....how can i do this..by populate word i mean that checkboxes should be checked or unchecked on some condition basis.......
3
by: Johnb41 | last post by:
My web page has a bunch of text boxes, check boxes, radio buttons, etc. The checkboxes have an OnCheckedChanged event. The textboxes have an OnTextChanged event. etc... When my page is...
12
by: KL | last post by:
Is there a way to redirect with javascript? I used javascript to do some validation on a form, but the form was set to redirect back to the index page after the submit button was clicked. So what...
3
by: KL | last post by:
I am trying to get a form to work with validating a checkbox. It validates the checkbox ok, but it always redirects, even if the box isn't checked...it does alert, but I was hoping that it would...
10
by: rn5a | last post by:
All the rows in a DataGrid, including the Header, are accompanied with a CheckBox. I want that when the CheckBox in the Header is checked, then all the CheckBoxes should automatically get checked....
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: 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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.