Single Item Form Field Calculation From Checkbox/Radio Button

L

Laura Bourgeois

I am working in FrontPage 2002. I am building a convention registration
form. Most items on the form may be purchased in quantities of one or more.
I bought the Form Field Calculator from WebsUnlimited to help me with those
subtotals and the grand total and it works beautifully. However, it does not
support check boxes or radio buttons (as I just heard from WU tech support).
There are four items on the form that are optional to purchase; but if
purchased, only one may be purchased. We want to make it impossible for more
than one to be purchased. Ideally, a user would click a check box to
purchase the single item, and the correct total would appear in the subtotal
box, as it does with the subtotal fields that calculate off a quantity of one
or more. I would very much appreciate any ideas; I am stumped and
frustrated! Thanks so much!
 
M

MD Websunlimited

Laura,

I've been thinking about this question and even though the functionality is not intrinsic to Form Calc you can accomplish it with a little bit of extra code.

1. Change the value of the check box from "on" to "1"
2. Create the FC expression using the onclick event for the checkbox using C1*5.95+T1+30.45 ..... where C1 is the checkbox and T1 is another field in the expression.

There is the fun part -- you'll need to add the following code to the onclick event of the check box

onclick="if (!this.checked) {this.value=0}; Expression(this.form,"C1*5.95+T1*30.95);"

HTH,
 
L

Laura Bourgeois

Thank you, Mike! I tried it, and I hope I interpreted your directions
correctly, although apparently I have not. When I click "generate" in the
Form Field Calculator, I get this error: "frmGenericInsert: Insert
ScriptHead 13:Type Mismatch," but it seems to generate anyway.

After adding the code you describe (the total cost of this item is $185),
after I click the check box on the form, the subtotal field remains blank,
even after tabbing through it. Here is the code I ended up with:

<input type="checkbox" name="MEMBER_CONVENTION_REGISTRATION"
value="1">Convention Registration submitted by May 1, $185:
<input type="text" name="MEMBER_CONVENTION_REGISTRATION_BY_MAY1" size="7"
onclick="if (!this.checked) {this.value=0};
"Expression(this.form,'MEMBER_CONVENTION_REGISTRATION_BY_MAY1=MEMBER_CONVENTION_REGISTRATION*85+MEMBER_CONVENTION_REGISTRATION_BY_MAY1+100');"></b></font></p>

If you have any further diagnosis or suggestions, I would very much
appreciate it! Thanks so much! Laura
 
M

MD Websunlimited

Laura,

You have the calculation on the wrong field it should go on the check box. Every field that is a part of the calculation will have
to have a calculation.
 

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