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.

What should be a simple 'button' script

Avatar

Former Community Member
Too old, too many hours working on this and too tight a deadline. This should be a simple script, but I'm getting nowhere fast!



User enters a dollar amount into a field called 'Pay', clicks one of four radio buttons called 'Frequency' labeled 'Weekly', 'By-weekly', 'Monthly' and 'Annual'. Based on button pressed, a field called 'Annual' is updated to reflect the results of:



Weekly = Pay * 52

Bi-weekly = Pay * 26

Monthly = Pay * 12

Annual = Pay * 1



Eventually, this form will be distributed throughout our entire organization, with completed forms being emailed to a central office. As a result, I'm working in LiveCycleES and Java, both of which I'm a novice with.



Any assistance from this forum is greatly appreciated. Even a link to a working example of this process that I could decipher on my own would be a great help.



Thanks so much.
1 Reply

Avatar

Former Community Member
For a radio button group called 'frequency' where the value binding is



1 - weekly

2 - bi-weekly

3 - monthly

4 - annual



you could add the following client-side JavaScript to the 'frequency' change event.



\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\



var frequency = form1.subform1.frequency.rawValue;



switch (frequency) {

case "1":

form1.subform1.annual.rawValue = form1.subform1.pay.rawValue * 52;

break;

case "2":

form1.subform1.annual.rawValue = form1.subform1.pay.rawValue * 26;

break;

case "3":

form1.subform1.annual.rawValue = form1.subform1.pay.rawValue * 12;

break;

case "4":

form1.subform1.annual.rawValue = form1.subform1.pay.rawValue * 1;

break;

default:

break;

}



\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\



Steve