I'm not really sure how I would do this. I've looked at lots of tutorials on the web but they're all automatic validation for a whole form, i want a button to only validate when a user has the cursor in a selected input box. When they submit the button if it is empty it will say Please enter a number or something. I could do this for the whole form, but what I want is so that the selected text box is the only one that is validated.
The second validation rule is to compare it against a set of numbers, I don't really have a clue how to do this
In more depth:
Say there are 5 input boxes. 3 of them have a number in them and 2 are blank e.g. 4,3,"",7,""
What i would like to be able to do, is if I had a set of numbers that they should be e.g. 4,3,5,7,3 and for there to be a check button, that when submitted, would validate the selected input box. For example when the button is pressed if the selected box was empty it would say "please enter a number" (i would do this with an if else statement i think) e.g.
Something along those lines. But if the incorrect number was entered it would say "Incorrect number" (it checks against the 5 numbers 43573). I think i might have to do something with focus so that is just says whether that specific input box is correct or not? I also don't know how i would check against these 5 numbers? I would like to be able to do this with larger lengths of numbers too.
Please help me, I can't find any tutorials covering anything like this
Thank you soooo much Fang! that's awesome! How would I make it so that only the box with the cursor currently in it is validated by the button? Or is that not possible? I want the user to be able to fill in the text boxes in any order and validate their latest entry as they go along. But yeah, thank you so much, it is such a big help!
Thank you Fang! That's what i was looking for it seems to check even if I haven't pressed the button, any ideas what I would do to prevent that from happening? It also jumps after it has checked to the next empty box, would it be possible for it just to lose focus or deselect? It's so close to being perfect though! Thank you for your help Fang, I've been pondering over this for quite sometime, it is appreciated sooooo much!!
You are an absolute star Fang!!! You are so helpful and kind helping me out! Thank you so much that is perfect. I hope you have a good weekend, take care
Is there anyway I could make it so it only validates the cell when the button is clicked? At the moment it automatically comes up with a warning even if I haven't pressed the button. I tried changing some bits of code but I couldn't get it to only validate the cell if the button is pressed. Any ideas? Sorry for being a pain thanks.
Bookmarks