Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

What script/code will make data appear in a cell when a radio button is selected?

Avatar

Level 1

https://nccer.box.com/s/ave99z5oq3avkixem9o13tdpjpyds156

When a customer chooses if they want their order expedited (see hyperlink above for document) they will choose an appropriate radio button to designate that choice. In return, I want their choice of radio button to input a value into the cell labeled "Expedite Fee."

What and which script is necessary for this action? I'm very new to javascript and formcalc.

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Try this FormCalc in the calculate event of the Expedite Fee field (that is topmostSubform.Page1.Table1.Row14.Cell5::calculate - (FormCalc, client));

Choose(RadioButtonList[1], 0, 50, 35)

Regular, Overnight and 2nd-day return 1, 2 or 3 respectively, in the Choose function that will return the first, second, or third argument.

It might help read your code later if you give your fields a meaningful name, so RadioButtonList[1] could be renamed Shipping and then the code would be Choose(Shipping, 0, 50, 35)

Regards

Bruce

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

Hi,

Try this FormCalc in the calculate event of the Expedite Fee field (that is topmostSubform.Page1.Table1.Row14.Cell5::calculate - (FormCalc, client));

Choose(RadioButtonList[1], 0, 50, 35)

Regular, Overnight and 2nd-day return 1, 2 or 3 respectively, in the Choose function that will return the first, second, or third argument.

It might help read your code later if you give your fields a meaningful name, so RadioButtonList[1] could be renamed Shipping and then the code would be Choose(Shipping, 0, 50, 35)

Regards

Bruce

Avatar

Level 1

Worked perfectly! Thanks so much!

Can you also help me with the formcalc script for making a value in the cell "Shipping & Handling" appear when the subtotal falls within set limits? I have a table above my order table that details the order subtotal amount and the shipping and handling fees that would incur. I'm thinking I need some kind of inequality?

I appreciate your help so much!

Thanks in advance!!

Avatar

Level 10

Hi,

Try this FormCalc in the calculate event of the Shipping & Handling field (that is topmostSubform.Page1.Table1.Row13.Cell5)

if ( Within(Row12.Cell5, 0.01, 19.99) ) then 11

elseif ( Within(Row12.Cell5, 20, 39.99) ) then 15

elseif ( Within(Row12.Cell5, 40, 79.99) ) then 17.95

elseif ( Within(Row12.Cell5, 80, 99.99) ) then 19.95

elseif ( Within(Row12.Cell5, 100, 149.99) ) then 22.5

elseif ( Within(Row12.Cell5, 150, 199.99) ) then 23.5

elseif ( Within(Row12.Cell5, 200, 249.99) ) then 24.5

elseif ( Row12.Cell5 > 250 ) then Row12.Cell5 * 0.1 endif

Regards

Bruce