Adding condition to the numeric variable

Dec 26, 2021

Hi there,

I downloaded practice files for numeric variables using the following link.

In this link, there is an activity which learners were supposed to do on their own. It is about adding up total number of working hours in a week. I could do everything with the help of the final files. However, could not apply condition to submit button which restricts number of user clicks. Currently, number of clicks are unlimited; with each click the final answer is multiplying. 

Please help. 



1 Reply
Maria Costa-Stienstra

Hi, Bharti.

Thank you for reaching out!

There are a few different ways to accomplish what you're looking to do (limit the times the submit button is clicked, so it doesn't add the calculation to the results each time). Here are two options:

  1. Set the variables (HoursMonday, HoursTuesday, etc.) to 0 after the submit button is clicked. 
  2. Set submit to disabled once it's clicked. 

I'd also create a Clear button in both those scenarios to clear the total (set WeeklyHours to 0), and on the second option, re-enable the button. 

I hope this helps!