Highlighted

What should be a simple 'button' script

Avatar

Guest

28-03-2009

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.

Replies

Highlighted

Steve_L_Walker

28-03-2009

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