Click to See Complete Forum and Search --> : validation from JOption
keko2005
12-02-2006, 09:14 PM
hey guys im prompting a user for information. when the user gets up to entering account num and age and amount, i wanna check on the spot if they have entered a number, not letters or special chars. if they enter anything but a number i want to keep prompting them. so, if the prompt ENTER AGE comes up and user enters the chars op, i wanna prompt them again ENTER AGE until they enter a correct number format.
thanks
Waylander
12-03-2006, 06:20 PM
I don't think you can put validation code into the actual option pane.
Last time I needed this I just stuck the prompt in a do while loop with a validation method that returns a boolean as the condition.
Waylander.
agent_x91
12-04-2006, 02:50 AM
I think Waylander's solution is likely to be the only work which will work properly. Just put it in a while loop to check the number format, and make it keep asking you for the number again until a valid number format is provided by the user.