This topic is locked
[SOLVED]

 How to prevent out of range input

10/10/2010 10:45:31 AM
PHPRunner General questions
B
btman author

Hi,

I have a DB in which is a field called seconds. User needs to input a number of seconds, but obviously only in the range of 0-59. How can I control thisand prevent that a higher value is entered? Is this done by SQL query or by event? For either, what would the code to be used be?

Any help is appreciated.

Thanks

Sergey Kornilov admin 10/10/2010

You need to proceed to Visual Editor, open 'Edit as' properties of this field and set 'Validate as' to Regular expression. Try the following regular expression: ^[0-5]?[0-9]$
More info: http://www.regular-expressions.info/numericranges.html