Perspective Checkbox fires onClick script twice

Ignition Perspective
8.1.1 (b2020120808)
Checkbox firing ‘onClick’ script, twice…

I ran into this problem and to confirm I made a simple perspective view with 1 Checkbox and 1 Label which has the same behavior.

I set the label’s prop.text = 1

I then added an onClick script to the Checkbox

	if self.props.selected:
		self.getSibling("Label").props.text += self.getSibling("Label").props.text
		self.getSibling("Label").props.text -= self.getSibling("Label").props.text

When I click on the checkbox to set props.selected = True the labels text changes to 4! Which means it did 1+1=2 and then fired again to do 2+2=4.

If I click the Checkbox again the label’s text changes to 0.

This is what the console reads when clicking the checkbox once to select it and a second time to de-select it

13:23:35.988 [Browser Thread: 57052] INFO Perspective.Designer.Workspace - select
13:23:35.989 [Browser Thread: 57052] INFO Perspective.Designer.Workspace - select
13:23:37.138 [Browser Thread: 57052] INFO Perspective.Designer.Workspace - de-select
13:23:37.138 [Browser Thread: 57052] INFO Perspective.Designer.Workspace - de-select

I can’t figure out why it is firing twice. I don’t recall this issue occurring in an early version of 8.0. I’m digging up an old project and an existing view, that I believe was working previously, now seems to fire twice causing an issue.


I’m seeing this too, and am unsure of when it was introduced. It appears that onActionPerformed is working correctly, and I always recommend using that event anyway.

Update: It was introduced in our theming update as part of 8.0.13.

Thanks, I can modify my checkboxes to utilize the onActionPerformed event instead.

Is there a reason you recommend the onAcitonPerformed over the onClick?

Primary reason for me is onClick ALWAYS fires when the control is clicked on, onActionPerformed only fires if the control is enabled.

As @MMaynard said: The onClick Event will “fire” even if the checkbox is disabled, whereas the onActionPerformed Event allows for you to disable the component based on potential security requirements. So if a user does not have the required security considerations, and the component is disabled due to this, then the script will not execute even when the component is clicked on.