Respect validation for Select

272 Views Asked by At

I'm using Respect validation for my PHP form. It works fine for all elements but not sure which validation rule to use for the country select element. The default value (when the select box displays 'Please select one') is -1. In all other cases, the value is a string. So I want to check if the value of country is different from -1. Obviously v::notEmpty() does not work. Is there a validation rule in Respect for something like this? or should I write my own rule? Thanks.

1

There are 1 best solutions below

0
On

v::stringType()->notEmpty()->validate($country); should work....

see documentation: StringType, NotEmpty