Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [SF][SF3] Id formularza i kontrolek
nospor
post
Post #1





Grupa: Moderatorzy
Postów: 36 561
Pomógł: 6315
Dołączył: 27.12.2004




Hejka, tworze sobie klase do forma, ktory nie bedzie korzystal z zadnej encji, tylko bedzie mial pola zdefiniowane przeze mnie
  1. class JsonType extends AbstractType
  2. {
  3. protected $textAreaOptions = [
  4. 'label' => false,
  5. 'attr' => [
  6. 'rows' => 8,
  7. ]
  8. ];
  9.  
  10. public function buildForm(FormBuilderInterface $builder, array $options)
  11. {
  12. $builder
  13. ->add('source', TextareaType::class, $this->textAreaOptions)
  14. ->add('destination', TextareaType::class, $this->textAreaOptions);
  15. }
  16. }


oraz w kontrolerze:
  1. $form = $this->createForm(jsonType::class,[], ['attr' => ['id' => 'json_decode']]);

Kod jaki mi to generuje to:
  1. <form class="form-horizontal" id="json_decode" method="post" name="json">
  2. <div id="json"> <div class="form-group"><div class="col-sm-12"><textarea class="form-control" rows="8" required="required" name="json[source]" id="json_source"></textarea></div></div> <div class="form-group"><div class="col-sm-12"><textarea class="form-control" rows="8" required="required" name="json[destination]" id="json_destination"></textarea></div></div><input type="hidden" value="wXUTKqW3pb4wdOF88k2d-S0pn1sw0M0dxvdBa44CsGc" class="form-control" name="json[_token]" id="json__token"></div>
  3. </form>

O ile id forma sie zgadza czyli json_decode to niestety juz id pol nie:id="json_source"
a chcialbym: id="json_decode_source"

Idzie to jakos odgornie ustawic? Googlam i szperam i marnie.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.12.2025 - 22:39