Click to See Complete Forum and Search --> : Checkbox order form with two values - help


kathyplack
06-27-2003, 12:28 PM
I am using an free javascript order form with checkboxes on my site at hhofg.com/order.html. I have set two values for the checkboxes, but don't know how to get the form to pullup the first value for any of the 49 states and the second value for mine (Hawaii). Can anyone help me to add that piece of code?
Much ALOHA!

Jona
06-27-2003, 12:52 PM
Originally posted by kathyplack
I have set two values for the checkboxes, but don't know how to get the form to pullup the first value for any of the 49 states and the second value for mine (Hawaii). Can anyone help me to add that piece of code?

Could you please be specific about what you need?

[Jona]

kathyplack
06-27-2003, 02:12 PM
Hi Jona,

I have an order form at https://ssl.adgrafix.com/users/hhofg/order.html. I need to tweak the coding in the script on it so that it gives the total for the first $ amount on the value for the checkbox if they fill in the state field for any other state than HI, and the second $ amount on the value for the checkbox if they fill out the state field for HI. Currently it is only giving the second value no matter what. I think what I need is an if then statement for the state field coinciding with the values? Does that clarify it any better? Is this possible? Help would be greatly appreciated!

Jona
06-27-2003, 02:16 PM
Originally posted by kathyplack
Does that clarify it any better?

Unfortunately, no, it doesn't. I have no earthly idea what "HI" is, for one. Second, I don't grasp the concept. You want the first set of checkboxes to evaluate a total in one text field, and the second set to do the same thing but in a second text field?

[Jona]

Exuro
06-27-2003, 02:19 PM
I think you want something like this:

<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function pickValue() {
if (document.form1.state.value == "Hawaii") {
document.form1.check1.value = "hawaii's value"
}
else {
document.form1.check1.value = "default value"
}
}
// -->
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="form1">
<SELECT NAME="state" onChange="pickValue()">
<OPTION VALUE="">Select a State</OPTION>
<OPTION VALUE="Oregon">Oregon</OPTION>
<OPTION VALUE="Hawaii">Hawaii</OPTION>
</SELECT>
<BR>
<INPUT TYPE="checkbox" NAME="check1" VALUE="default value">
<BR>
<INPUT TYPE="submit">
</FORM>
</BODY>
</HTML>

Does that help?

Exuro
06-27-2003, 05:07 PM
Okay, I attached an text file (HTML source code) that I believe should work now... I just saved your page and edited it so that it would do what I think you wanted it to do. The only problem is, if the person checks a box, then changes the state, then unchecks it, it could create some problems... I believe this could be fixed by finding the total of all the elements when the Submit button is hit rather than as each box is checked. I'm a little bit busy right now so I can't do it though... Maybe someone else could pick up where I left off?

kathyplack
06-27-2003, 07:55 PM
OOOPS. I was dealing with my daughter when I posted a new thread instead of a reply. Here it is again!!

That's exactly what I am looking for, I really appreciate the help. It is giving the dual values for the states, however when you check any other checkboxes it brings the total back to $0. I am patient if you can find the time! The idea of the totaling on submit is good, but I'd rather it change as they change the boxes so they can see what they are submitting before they submit.

All your help is so greatly appreciated!

kathyplack
06-27-2003, 07:57 PM
OOOPS. I was dealing with my daughter when I posted a new thread instead of a reply. Here it is again!!

That's exactly what I am looking for, I really appreciate the help. It is giving the dual values for the states, however when you check any other checkboxes it brings the total back to $0. I am patient if you can find the time! The idea of the totaling on submit is good, but I'd rather it change as they change the boxes so they can see what they are submitting before they submit.

All your help is so greatly appreciated!

Also, I uploaded the previous changes to a new page at https://ssl.adgrafix.com/users/hhofg/orders.html so that my users can use the other page without any complications of the changes we are trying to make.