<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\Collection;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
class ContactType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
// $builder->add('email', 'text',array('label'=>'Ingrese el email'));
$builder->add('usuario', TextType::class,array('label'=>'Ingrese el Usuario','required'=>true,'attr' => array(
"maxlength" => "20")));
$builder->add('clave', \Symfony\Component\Form\Extension\Core\Type\PasswordType::class,array('label'=>'Ingrese la clave','required'=>true,'attr' => array(
"maxlength" => "30")));
// $builder->add('message', 'text',array('label'=>'Ingrese un Mesaje'));
}
public function getDefaultOptions(array $options)
{
$collectionConstraint = new Collection(array(
//'email' => new Email(),
'usuario' => new NotBlank(),
'clave' => new NotBlank(),
//'message' => new NotBlank(),
));
$options['validation_constraint'] = $collectionConstraint;
return $options;
}
public function getName()
{
return 'contact';
}
}