Expand my Community achievements bar.

Update the value of an already clicked checkbox

Avatar

Former Community Member

Hi, I still have a lot to learn about LiveCycle coding, so any help will be greatly appreciated.

On my form, when a certain checkbox is clicked, It adds this optional string to a textfield:

"x of y items"

x and y are defined by user entered numeric fields.

If a users changes one of these numeric fields after checking the checkbox, the change does not show up unless the user unchecks and rechecks the checkbox. (the checkbox has an If statement on the click event which is basically; if on, Concat numeric fields, else resetData)

Is there any way to have changes to these numeric fields automatically recalculate the checkbox?

Thanks!

3 Replies

Avatar

Former Community Member

What event do you have your code on ......I woudl put it on the calculate event .....that will fire when any of the fields named in the calc change.

Paul

Avatar

Former Community Member

I had the code in the "click" event.  I moved it to the calculate event and it works better --when a change is made to one of the numeric fields, the textfield goes blank until the checkbox is clicked again.  (Instead of the numbers not changing at all until the checkbox is cleared and rechecked) 

Here is the code on the check box:

form1.ItemWorksheet.CheckBox1::calculate - (FormCalc, client)

if

(this.rawValue == "1") then

TextField1.rawValue

= Concat(NumericField1, " of ", NumericField2, " items.")

else

TextField1.rawValue

= " "

endif

I guess using a checkbox for this is the problem, the checkbox will always put an instance of the concatenated value in the textfield.  If the fields that make up that text are changed, the checkbox needs to reset and be clicked again to put the new instance in.  Maybe if the checkbox could toggle the visibility of the of the concatenated text?

I will go with keeping the code on the calculate event and add instruction for the user, "if you change these fields re-click the checkbox"

Thanks for the help!

Avatar

Former Community Member

What if you just added an else portion to your statement .....if you get into th eelse that means that the checkbox is off or zero.

Paul