<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\TimeType;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\Extension\Core\Type\TelType;
use Symfony\Component\Form\Extension\Core\Type\FileType;
use Symfony\Component\Validator\Constraints\File;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Choice;
class ContactFormType extends AbstractType
{
/**
* @inheritDoc
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', TextType::class, [
'label' => 'form.contact.Name',
'required' => false,
'error_bubbling' => true,
'constraints' => [
new NotBlank(['message' => 'form.contact.Name.not.blank'])
],
'attr' => [
'placeholder' => 'form.contact.Name'
]
])
->add('lastname', TextType::class, [
'label' => 'form.contact.Lastname',
'required' => false,
'error_bubbling' => true,
'constraints' => [
new NotBlank(['message' => 'form.contact.Lastname.not.blank'])
],
'attr' => [
//'style' => 'height: 250px;'
'placeholder' => 'form.contact.Lastname'
]
])
/*->add('company', TextType::class, [
'label' => 'form.contact.Company',
'required' => false,
'error_bubbling' => true,
'constraints' => [
new NotBlank(['message' => 'form.contact.Company.not.blank'])
],
'attr' => [
//'style' => 'height: 250px;'
'placeholder' => 'form.contact.Company'
]
])*/
->add('tel', TextType::class, [
'label' => 'form.contact.Tel',
'required' => false,
'error_bubbling' => true,
'constraints' => [
new NotBlank(['message' => 'form.contact.Tel.not.blank'])
],
'attr' => [
//'style' => 'height: 250px;'
'placeholder' => 'form.contact.Tel'
]
])
->add('message', TextareaType::class, [
'label' => 'form.contact.Message',
'required' => false,
'error_bubbling' => true,
'attr' => [
//'style' => 'height: 250px;'
'placeholder' => 'form.contact.Message'
],
'constraints' => [
new NotBlank(['message' => 'form.contact.Message.not.blank'])
],
])
// email
->add('email', EmailType::class, [
'label' => 'form.contact.email',
'attr' => [
'placeholder' => 'form.contact.email'
],
'required' => false,
'error_bubbling' => true,
'constraints' => [
new NotBlank(['message' => 'form.contact.email.not.blank']),
new Email(['message' => 'form.contact.email.not-valid'])
]
])
// vr_mandat_pdf
/*
->add('vr_mandat_pdf', FileType::class, [
'label' => 'vr_mandat_pdf',
'attr' => [
'placeholder' => '',
'class' => 'original-file-input',
'data-file' => '1',
'accept' => '.pdf'
],
'required' => false,
'error_bubbling' => false,
'constraints' => [
new File([
'maxSize' => '5000k',
'maxSizeMessage' => 'vr-mandat_pdf.toobig',
'mimeTypes' => [
'application/pdf'
],
'mimeTypesMessage' => 'vr-mandat_pdf.wrongtype'
])
]
])
*/
->add('disclaimer', CheckboxType::class, [
'label' => 'disclaimer_gelesen_und_akzeptiert',
'required' => false,
'attr' => [
'class' => 'disclaimer-proof'
],
'error_bubbling' => true,
'constraints' => [
new NotBlank(['message' => 'form.contact.disclaimer.not.blank'])
]
])
// hidden
->add('hidden', HiddenType::class, [
'required' => false
])
// js filled
->add('filled', HiddenType::class, [
'required' => true
])
->add('submit', SubmitType::class, [
'label' => 'absenden'
]);
}
/**
* @inheritDoc
*/
public function configureOptions(OptionsResolver $resolver)
{
}
}