This topic is locked

Validate field

2/24/2011 5:45:36 PM
PHPRunner General questions
P
piobote author

Hello,
I would like to get this message: "The value of this field can not be greater than 500" when adding a new numeric data greater than 500.
Please help me!
Thanks

P
procheck 2/24/2011

if ($values["fieldname"] > 500)

{

$message = "The value of this field can not be greater than 500"

}
$values["fieldname"] is dependent on what event you're in. You could also use a simple vaiable name like $money.

P
piobote author 2/25/2011

I am looking for a way to prevent the user to add a value > 500 when validating with the save button (something like the required case)
Thanks for your help!
Pedro

P
piobote author 2/25/2011

I found the solution by using Regular expression on the field:
Add Page / Visual Editor/ Edit as / On Validate As / Regular Expression / Regexp = ^[0-5][0][0]$
May be helpful...
Thanks
Pedro