I am producing a registration form that uses radio buttons to specify meal and requirements accommodation for individual registrants — separate radio buttons select the meal plan (YES or NO) and accommodation type (NO THANKS, A, B, or D).
I want to query the state of these radio buttons and, if selected (set), calculate the amount to charge for registration in the related sub-total fields (Meal Plan and Accommodations). In other words, based on the $ charges for YES, A, B, and D on a per registrant basis, I want to enter a $ amount in the sub-total fields "Meal Plan" and "Accommodations". When NO or NO THANKS is selected then no calculation is necessary.
In the attached form, if a given registrant (say Reg01) chooses to include a meal plan (radio button M01-Y selected) then in the numMEAL sub-total field should increment by $80. Similarly, if Reg01 wants to book a double room (R01-D) I want to add $268 to the numROOM sub-total field. It goes without saying that the numMEAL and numROOM fields need to reflect the cumulative amount based on the requirements of all listed registrants (Reg01 thru Reg05)
Example: I want to use a FormCalc calculation something like . . . (If M01-Y is set then $80) + (If M01-Y is set then $80) + etc . . . to calculate the numMEAL field value and an equivalent expression for the numROOM field.
Also (but don't feel obliged to answer), in the design view how do I configure the radio button selections to show No or NO THANKS as the default selection (set) such that the remaining buttons in the MEAL PLAN and ROOM TYPE groups are not selected (not set) — (I think that would correct the error indications I'm seeing). I managed to configure this initial radio button state for the form's CITIZENSHIP and PAYMENT TYPE groups but can't seem to do it for the MEAL PLAN and ROOM TYPE groups.
Thanks in advance for your help.
Solved! Go to Solution.
Views
Replies
Total Likes
I think this is what you wanted ....see attachment. The issue with the multiple selections in the Design view is because of the - in the name. I changed it for the Rooms as it is being interpretted as a subtraction. You shoudl change them in the Meal radiobuttons as well and that will clear up the design issue you mentioned.
To get the room to add correctly I changed the vaue that is reported to the price of the room. Then on the calculate event of the Accomodations field I simply add all of the room radioButtonList up. The calculate event will fire each time a Room is changed. For the Meals I put the code on the RadioButtonList for each meal (just to show you a different technique). You could od it exactly the same way as the rooms but that is up to you.
Paul
Views
Replies
Total Likes
I think this is what you wanted ....see attachment. The issue with the multiple selections in the Design view is because of the - in the name. I changed it for the Rooms as it is being interpretted as a subtraction. You shoudl change them in the Meal radiobuttons as well and that will clear up the design issue you mentioned.
To get the room to add correctly I changed the vaue that is reported to the price of the room. Then on the calculate event of the Accomodations field I simply add all of the room radioButtonList up. The calculate event will fire each time a Room is changed. For the Meals I put the code on the RadioButtonList for each meal (just to show you a different technique). You could od it exactly the same way as the rooms but that is up to you.
Paul
Views
Replies
Total Likes
Your radio buttons exclusion groups need to be fixed. Currently you have all the radio buttons defined as a value of '1' which yields an 'on' state. Take a look at the attached PDF. I think it will answer your questions. If not, let me know.
It uses two different techniques to populate the respective field.
// form1.page1.subform1.mealPlan::change - (JavaScript, client)
if (form1.page1.subform1.mealPlan.rawValue == "1") {
form1.page1.subform1.mealPlanCost.rawValue = 80;
}
else {
if (form1.page1.subform1.mealPlan.rawValue == "0") {
form1.page1.subform1.mealPlanCost.rawValue = null;
}
}
// form1.page1.subform1.roomChoice::change - (JavaScript, client)
var roomOption = form1.page1.subform1.roomChoice.rawValue;
switch (roomOption) {
case "0":
form1.page1.subform1.roomCost.rawValue = null;
break;
case "1":
form1.page1.subform1.roomCost.rawValue = 188;
break;
case "2":
form1.page1.subform1.roomCost.rawValue = 228;
break;
case "3":
form1.page1.subform1.roomCost.rawValue = 268;
break;
default:
break;
}
Steve
Thanks Paul,
I really appreciate your help. If you have a moment, please see the attached WORD file that has some follow-up questions. I can tell you're busy (by the number of forum questions you address) so understand if you don't have the time for this follow-up.Once agian, thanks so very much for your help.
Questor 606 (Dave)
The attachment wasn't accepted so I re-sent this "Thank You" with PDF attachments.
Views
Replies
Total Likes
Paul,
Your PDF works exactly as I'd hoped. Thanks!
If you can spare me the time, I have a couple of follow-up questions, How do I "see" …
1. the scripting that "changes the value" reported by a radio button?
2. the scripting that “sums” these radio button values for the sub-totalling fields?
In my Design view, the only info that “appears” in the sub-totalling fields for MEALS and ROOMS is … $ = 0 … which sets the no-sum value to $0.00
(more info in attached PDF -- AdobeForum.pdf)
(also attached my revised form -- DraftForm-Rev02.pdf)
Thanks again for your great support,
Questor 606 (Dave)
Views
Replies
Total Likes
1. That info is set on the BInding tab of the radiobutton. If you look at the Object/Binding tab of the RadioButtonList then you can see and adjust all Radiobuttons in that group.
2. The code for subtotalling is on the calculate event of the subtotal field (for Rooms) and on the change event of each RadioButtonGroup (for Meals)
In your screen shot you are only showing one line ... make th escript editor bigger and you will see the rest of the code.
Also the individual radiobuttons in the meal alos have a - in them ...remove the - as per my modifed sample that I sent you earlier.
Paul
Views
Replies
Total Likes
Paul,
Thanks so much for helping build my skill set. One last question remains. How do I locate, diagnose, and fix the errors reported when the PDF Form is opened (see attached)?
Cheers,
Questor606 (Dave)
Views
Replies
Total Likes
I'm looking into it but I will not be able to get to it until next week.
Paul
Paul,
I think I figured it out. The "numeric fields" that make up the set of sub-total calculations (and the overall total as well) were labelled "decimal field". I could not find out how this label was specified. The error messages disappeared after I replaced these fields with new ones labelled "numeric field" and setting the "field pattern" to "$1234.21" for both "data" and "display".
Thanks again for all your support,
Questor606 (Dave)
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies