php - Symfony2 displaying countries states and cities based on the input -
i trying create registration form symfony2 formbuilder. first time , have few problems. how can display cities , states based on country input? exampel if select uk want of states of uk, , after states of cities in state... how achieved? found country option in form documentation, displays of countries... states , cities?
this form:
public function registeraction() { $em = $this->getdoctrine()->getmanager(); $products = $em->getrepository('mpshopbundle:product')->findall(); $form = $this->createformbuilder() ->add('title', 'choice', array( 'choices' => array('-' => '-', 'mr' => 'mr.', 'mrs' => 'mrs.', 'mss' => 'miss.'))) ->add('firstname', 'text') ->add('lastname', 'text') ->add('email', 'email') ->add('password', 'password') ->add('dateofbirth', 'date') ->add('company', 'text') ->add('adress', 'text') ->add('country', 'country') ->add('state', 'locale') ->add('city', 'text') ->add('zippostalcode', 'text') ->add('additionalinformation', 'textarea') ->add('homephone', 'number') ->add('mobilephone', 'number') ->getform() ; return $this->render('mpshopbundle:frontend:registration.html.twig', array( 'products'=>$products, 'form'=>$form->createview(), )); }
what can do>?
http://symfony.com/doc/current/reference/forms/types/form.html
look translation_domain option allow set custom label depending of language
$builder->add( 'author_name', 'text', array('label' => 'comment.author_name', 'translation_domain' => 'mydomain
Comments
Post a Comment