Commit bfb74323b0ace2be7e47952ff894c74646f5fd8f
1 parent
fce26637fd
Exists in
master
Creado el formulario para enviar correo con bootstrap y validacion
Showing
1 changed file
with
86 additions
and
0 deletions
Show diff stats
src/AppBundle/Form/SolicitarType.php
... | ... | @@ -0,0 +1,86 @@ |
1 | +<?php | |
2 | +/** | |
3 | + * Created by PhpStorm. | |
4 | + * User: ubv-cipee | |
5 | + * Date: 01/07/16 | |
6 | + * Time: 07:52 AM | |
7 | + */ | |
8 | + | |
9 | +namespace AppBundle\Form; | |
10 | + | |
11 | +use Symfony\Component\Form\AbstractType; | |
12 | +use Symfony\Component\Form\FormBuilderInterface; | |
13 | +use Symfony\Component\Form\Extension\Core\Type\TextType; | |
14 | +use Symfony\Component\Form\Extension\Core\Type\EmailType; | |
15 | +use Symfony\Component\Form\Extension\Core\Type\NumberType; | |
16 | +use Symfony\Bridge\Doctrine\Form\Type\EntityType; | |
17 | +use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |
18 | + | |
19 | +use Symfony\Component\Validator\Constraints\Email; | |
20 | +use Symfony\Component\Validator\Constraints\Length; | |
21 | +use Symfony\Component\Validator\Constraints\NotBlank; | |
22 | + | |
23 | + | |
24 | + | |
25 | +class SolicitarType extends AbstractType | |
26 | +{ | |
27 | + /** | |
28 | + * @param FormBuilderInterface $builder | |
29 | + * @param array $options | |
30 | + */ | |
31 | + public function buildForm(FormBuilderInterface $builder, array $options) | |
32 | + { | |
33 | + $builder | |
34 | + ->add('nombres', TextType::class, array( | |
35 | + 'attr' => array('placeholder' => 'Nombres...'), | |
36 | + 'constraints' => array( | |
37 | + new NotBlank(), | |
38 | + new Length(array('min' => 3)), | |
39 | + ) | |
40 | + )) | |
41 | + ->add('apellidos', TextType::class, array( | |
42 | + 'attr' => array('placeholder' => 'Apellidos...'), | |
43 | + 'constraints' => array( | |
44 | + new NotBlank(), | |
45 | + new Length(array('min' => 3)), | |
46 | + ) | |
47 | + )) | |
48 | + ->add('cedula', NumberType::class, array( | |
49 | + 'attr' => array('placeholder' => 'Cédula o Pasaporte...'), | |
50 | + 'constraints' => array( | |
51 | + new NotBlank(), | |
52 | + new Length(array('min' => 7)), | |
53 | + new Length(array('max' => 10)), | |
54 | + ), | |
55 | + 'label' => 'Cédula' | |
56 | + )) | |
57 | + ->add('correo', EmailType::class, array( | |
58 | + 'attr' => array('placeholder' => 'Dirección de Correo...'), | |
59 | + 'constraints' => array( | |
60 | + new NotBlank(), | |
61 | + new Email() | |
62 | + ) | |
63 | + )) | |
64 | + | |
65 | + ->add('eje', EntityType::class, array( | |
66 | + 'placeholder' => 'Seleccione el Eje al Cual está Adscrito', | |
67 | + 'class' => 'AppBundle:Eje', | |
68 | + 'choice_label' => 'getNombre', | |
69 | + )) | |
70 | + ->add('send', SubmitType::class, array('label' => 'Enviar Solicitud')); | |
71 | + } | |
72 | + | |
73 | + | |
74 | + | |
75 | + | |
76 | + | |
77 | +// /** | |
78 | +// * @param OptionsResolver $resolver | |
79 | +// */ | |
80 | +// public function configureOptions(OptionsResolver $resolver) | |
81 | +// { | |
82 | +// $resolver->setDefaults(array( | |
83 | +// 'data_class' => 'AppBundle\Entity\Usuarios' | |
84 | +// )); | |
85 | +// } | |
86 | +} | |
0 | 87 | \ No newline at end of file | ... | ... |