Expand my Community achievements bar.

Numeric Field Populates based on Check box

Avatar

Level 1

I am currently using Adoboe LiveCycle Designer 7.0 trying to develop a QA scorecard.

I need to know how to write a script so that when a checkbox is selected a numeric field returns a defined number.  If the box is left uncheked the numeric field would populate with a zero.

  For example. There are 12 checkboxes.  For each box checked the value displayed in the numeric field may be either 10, 20, 30, 40 etc depending on the importance of the item.  Each checkbox would correspond to a QA metric. The final numeric field would simply provide a sum of the 12 other numeric fields.

13 Replies

Avatar

Former Community Member

So for each checkbox that you tick the numeric field is incremented by 10?

Do you have a sample form that you have started? Can you share it with us to giv eus a starting point?

Paul

Avatar

Level 1

Not necessarily. The number will be either 0, if unticked, 10 or 20 as predetermined by me. So a result of 10 means that particular metic carriess less Quality assurance weight than one that returns a 20.

Avatar

Former Community Member

So depending on which checkbox the tick you have predetermined that the value of that metric. In that case the code woudl be something like this:

On the change event of the checkbox:

if (this.rawValue == 1){    

     numeric Field Name.rawValue = numeric Field Name.rawValue + 10

} else {

     numeric Field Name.rawValue = numeric Field Na,e.rawValue - 10

}

Note that the on/off value of the checkbox is programmable (itis 0/1 by default) so you check to make sure that it is 1 for on (in the Object/Binding tab).

Paul

Avatar

Level 1

Here is an example. As you can see QA1 carries more weight so if the box is clicked 20% would populate. Conversely QA4 is less important and would populate 10%.

QA1

x

20%

QA2

0%

QA3

0%

QA4

x

10%

QA5

0%

QA6

0%

QA7

x

10%

Total Score

40%

Avatar

Level 1

Here's a better snap shot. I need the script for one check box and I can change the value that appears in the number field for each of the other ones.

Avatar

Level 1

My bad, I pasted it directly into the email. Here it is.

So, the numeric box to the right would populate with a value is the corresponding left checkbox is clicked.

Avatar

Level 1

It should be attached now. I was trying to send it through email.

Avatar

Former Community Member

So is it as simple as saying that if the checkbox beside As400 complete and accurate ..... is checked that you want 20% to appear in teh field to the right of the checkbox?

Paul

Avatar

Former Community Member

Then on the change event of the checkbox field you can add code like this:

if (this.rawValue == 1){

     Percentage Box Name.rawValue = 20%

} else {

     Percentage Box Name.rawValue = 0%

}

You would need one of these statements for each checkbox, adjusting the value you want to place i th ebox accordingly.

Each time the checkbox is changed (either on or off) the code will run and adjust the associated box.

Paul