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 -

c# - How do I get the Nth largest element from a list with duplicates, using LINQ? -

jsp - "Sending a redirect is forbidden after the response has been committed" in sendRedirect -