Timers are tricky… In general, it is more reliable to use a dedicated dynamic panel with at least two states as a “timer function”; use the “Set Panel State to Next, wrap, repeat every N ms”. But in your case, since the user cannot click the Send button again it should and does appear to work well enough by recursively “clicking itself again” with the Fire Event action.
You are on the right track and close to a working solution, but I found three basic issues with your interaction logic:
You don’t need a case for the Click or Tap event of “EV_resend button” because the first thing you do in the “EV_send button” is to disable “EV_resend button” until 5 seconds have elapsed and the global variable, “verification_countdown” value is less than zero (then you enable it.) So, if “verification_countdown” is greater than or equal to zero, nothing will happen if “EV_resend button” is clicked–no event will be triggered since it is disabled. But in Case 1 you state “If value of verification_countdown is greater than or equals 0” --which would never be true if “EV_resend button” were enabled.
You never reset the value of “verification_countdown” when your timer expires, so it is impossible to “count it down” again. It is best to reset the value in Case 2 of “EV_send button” (which is enacted when the value of “verification_countdown” is less than zero, and thus Case 1 evaluates to false.)
You don’t need to set up a separate timer in the “EV_resend button” code, because you want it to do the exact same thing as Case 1 of “EV_send button” already does. So, all you really need to do in the Click or Tap event of “EV_resend button” is to trigger a click of “EV_send button” with “Fire Event EV_send button fire Click or Tap”.
See this updated file where I duplicated the Email verification page and applied these fixes. One small thing to note is the timer duration is actually 6 seconds because you start at 5 and decrease “verification_countdown” to “less than 0” (meaning it stops at value of “-1”) --you can adjust this by either starting at “verification_countdown” = 4 or setting the Case 1 condition to “greater than 0”.
countdownissue.rp (154.7 KB)