symfony - Validate a Timezone field in symfony2 -


i'm using symfony2, created form field timezone. problem don't know how validate field. can't find in documentation "validation constraints reference" appropriate constraint.

you have make custom constraint, here how works :

http://symfony.com/doc/current/cookbook/validation/custom_constraint.html

here logic validate() function:

if (in_array($timezone, datetimezone::listidentifiers())) {     echo "valid"; } else {     echo "invalid"; } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -