How do I redirect with a checkbox?

S

Sunshine

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..
 
J

Joakim Braun

Sunshine said:
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
 

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

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top