Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Have to click on the button twice to execute code on Click event.

Avatar

Avatar
Validate 10
Level 2
1996_kcv
Level 2

Likes

2 likes

Total Posts

85 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 1
View profile

Avatar
Validate 10
Level 2
1996_kcv
Level 2

Likes

2 likes

Total Posts

85 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 1
View profile
1996_kcv
Level 2

01-12-2011

I have a button that has following code on the click event.
_SubFormS.setInstances(0);

Last week I added following code on the Exit event of the button.
xfa.host.setFocus(Subf.ButtonRemove);

For some reason, I have to click twice to set instance to 0. It never happened before. If I comment out code on Exit even, nothing changes. Any ideas for this bizarre behaviour.

Thank you.

View Entire Topic

Avatar

Avatar
Give Back 3
Level 2
past-tense
Level 2

Likes

9 likes

Total Posts

85 posts

Correct Reply

10 solutions
Top badges earned
Give Back 3
Give Back
Validate 1
Boost 5
Boost 3
View profile

Avatar
Give Back 3
Level 2
past-tense
Level 2

Likes

9 likes

Total Posts

85 posts

Correct Reply

10 solutions
Top badges earned
Give Back 3
Give Back
Validate 1
Boost 5
Boost 3
View profile
past-tense
Level 2

02-12-2011

Hey 1996,

It sounds to me like you have a setfocus soomehwere that is still overriding the click event. For example, if you have a field that doesn't check if (xfa.event.commitKey == 3) before setFocus is called, it doesn't matter which other field (or button) you click on, you will be sent to the field specified by the setFocus. "Double clicking" isn't a double click, it's one click which is overridden by a setFocus (which sends you somewhere else) then a second click which isn't interrupted by a setfocus, which means that you can click the button.

I don't think that I've explained myself well, so here is step-by-step what I think is happening:

- You are currently in a field that just has a setFocus without checking the commitKey.

- You click on the button.

- Due to the setFocus, you are sent to a different field that is not the button. This means that the button never fires teh click event. the second field that you are sent to has the proper commitKey checks.

- You click on the button again,

- This time, because the new field you are in has the proper commitKey check, you are not sent to another field, and your click succeeds.

I hope that did a good job of explaining my guess as to what is happening. Check all of your exit events to make sure that they are all using the if (xfa.event.commitKey == 3) then bit. having forgotten one would explain why this doesn't happen all the time... it's only happening when you try to click the button while you are in the field wihtout the commitKey check.

Let me know if that helps,

- Scott