How do I change the value of a hidden field?

G

Guest

I have a general registration form that, on Submit, goes to a Verisign
payment page, passing the following hidden field value:

<input type="HIDDEN" name="UNIQUE_ID" value="Exec_Forums_India_2007">

From the above value, the price of $1450 is determined on the verisign
payment page.

What I need to do is to create a checkbox, asking registrants if they are
Alumni of Stanford:

<input type="checkbox" name="Alum" value="ON">

And, if they are Alums (checkbox = ON), then change the value of the
above-mention hidden field to value="Exec_Forums_India_2007AD" so they can be
charged $1250 on the payment screen.

Can someone help please? Thank you.
 
K

Kevin Spencer

<form method="post" action="">
<script type="text/javascript"><!--
function handleCheck(checkbox)
{
var on = "Exec_Forums_India_2007AD";
var off = "Exec_Forums_India_2007";
var value = (checkbox.checked ? off : on);
document.getElementById("UNIQUE_ID").value = value;

}
// --></script>
<input type="checkbox" onclick="handleCheck(this)" id="Alum" name="Alum"
value="ON"/>
<input type="hidden" id="UNIQUE_ID" name="UNIQUE_ID"
value="Exec_Forums_India_2007"/>

</form>


--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.
 
G

Guest

For some reason I had to switch the var on/off values but it works perfectly.
Thank you so much!

Christine
 

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

Top