src/Form/TPermohonanType.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Entity\MPekerjaan;
  4. use App\Entity\TDiv;
  5. use App\Entity\TPermohonan;
  6. use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  7. use Symfony\Component\Form\AbstractType;
  8. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  9. use Symfony\Component\Form\Extension\Core\Type\NumberType;
  10. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  11. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  12. use Symfony\Component\Form\Extension\Core\Type\TextType;
  13. use Symfony\Component\Form\FormBuilderInterface;
  14. use Symfony\Component\OptionsResolver\OptionsResolver;
  15. class TPermohonanType extends AbstractType
  16. {
  17.     public function buildForm(FormBuilderInterface $builder, array $options)
  18.     {
  19.         $builder
  20.             ->add('nama'TextType::class, [
  21.                 'label' => 'Nama',
  22.                 'attr' => [
  23.                     'class' => 'form-control',
  24.                     'oninvalid' => 'this.setCustomValidity("Nama harus diisi!")',
  25.                     'oninput' => 'this.setCustomValidity("")'
  26.                 ]
  27.             ])
  28.             ->add('telepon'NumberType::class, [
  29.                 'label' => 'Telepon',
  30.                 'attr' => [
  31.                     'class' => 'form-control',
  32.                     'oninvalid' => 'this.setCustomValidity("Telepon harus diisi!")',
  33.                     'oninput' => 'this.setCustomValidity("")'
  34.                 ]
  35.             ])
  36.             ->add('email'EmailType::class, [
  37.                 'label' => 'Email',
  38.                 'attr' => [
  39.                     'class' => 'form-control',
  40.                     'oninvalid' => 'this.setCustomValidity("Email harus diisi!")',
  41.                     'oninput' => 'this.setCustomValidity("")'
  42.                 ]
  43.             ])
  44.             ->add('pekerjaan'EntityType::class, [
  45.                 'class' =>  MPekerjaan::class,
  46.                 'label' => 'Pekerjaan',
  47.                 'placeholder' => '--Pilih Pekerjaan--',
  48.                 'attr' => [
  49.                     'class' => 'form-control',
  50.                     'oninvalid' => 'this.setCustomValidity("Pekerjaan harus dipilih!")',
  51.                     'oninput' => 'this.setCustomValidity("")'
  52.                 ]
  53.             ])
  54.             ->add('desk_pekerjaan'TextType::class, [
  55.                 'label' => 'Deskripsi Pekerjaan',
  56.                 'attr' => [
  57.                     'class' => 'form-control'
  58.                 ],
  59.                 'required' =>false
  60.             ])
  61.             ->add('judul_data'TextType::class, [
  62.                 'label' => 'Judul Dataset',
  63.                 'attr' => [
  64.                     'class' => 'form-control',
  65.                     'oninvalid' => 'this.setCustomValidity("Judul Dataset harus diisi!")',
  66.                     'oninput' => 'this.setCustomValidity("")'
  67.                 ]
  68.             ])
  69.             ->add('div'EntityType::class, [
  70.                 'class' => TDiv::class,
  71.                 'label' => 'Perangkat Daerah',
  72.                 'placeholder' => '--Pilih Perangkat Daerah--',
  73.                 'attr' => [
  74.                     'class' => 'form-control',
  75.                     'oninvalid' => 'this.setCustomValidity("Perangkat Daerah harus dipilih!")',
  76.                     'oninput' => 'this.setCustomValidity("")'
  77.                 ]
  78.             ])
  79.             ->add('desk_kebutuhan'TextareaType::class, [
  80.                 'label' => 'Deskripsi Kebutuhan Dataset',
  81.                 'attr' => [
  82.                     'class' => 'form-control',
  83.                     'oninvalid' => 'this.setCustomValidity("Deskripsi Kebutuhan Dataset harus diisi!")',
  84.                     'oninput' => 'this.setCustomValidity("")'
  85.                 ]
  86.             ])
  87.             ->add('tujuan_data'TextareaType::class, [
  88.                 'label' => 'Tujuan Penggunaan Dataset',
  89.                 'attr' => [
  90.                     'class' => 'form-control',
  91.                     'oninvalid' => 'this.setCustomValidity("Tujuan Penggunaan Dataset harus diisi!")',
  92.                     'oninput' => 'this.setCustomValidity("")'
  93.                 ]
  94.             ])
  95.             ->add('submit'SubmitType::class, [
  96.                 'label' => 'Kirim',
  97.                 'attr' => [
  98.                     'class' => 'btn btn-light bg-green'
  99.                 ]
  100.             ])
  101.         ;
  102.     }
  103.     public function configureOptions(OptionsResolver $resolver)
  104.     {
  105.         $resolver->setDefaults([
  106.             'data_class' => TPermohonan::class,
  107.         ]);
  108.     }
  109. }