I have a page whereby the user can press left + right buttons to scroll through numbers between 1-10.
The default value is 0 which displays blank.
There are two buttons at the bottom which allow the user to ‘Clear’ the number – reseting it to 0. Or to ‘Shuffle’, picking a random number.
After this the user can submit these numbers into a database.
My issue is, if the user were to scroll to 5 (for example), click shuffle then submit, it would submit ‘5’ instead of the random number it should have generated.
Also if the user only clicks ‘shuffle’ then submit, it’ll input ‘0’.
The issue with the ‘clear’ button is similar, if the user scrolls to 5, then hits reset, the variable would stay at ‘5’ when submitted.
I’m probably overcomplicating something very simple, and im sorry if i am, but this is annoying me.
Thankyou ~
I’m not entirely certain what the problem is without looking at your code. I get the feeling it is something like this:
Javascript
HTML form
What does your form look like? You’re most likely having a problem setting a value?
Link to example