Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [SF][SF2] Zmiana wyglądu pola formularza?
Randallmaster
post
Post #1





Grupa: Zarejestrowani
Postów: 677
Pomógł: 11
Dołączył: 18.11.2009

Ostrzeżenie: (0%)
-----


  1. //controller:
  2. $form = $this->createFormBuilder($task)
  3. ->setAction($this->generateUrl('pagesStore'))
  4. ->setMethod('POST')
  5. ->add('task', 'text')
  6. //...
  7.  
  8. //widok:
  9. {% block body %}
  10. {{ form_start(form) }}
  11. {{ form_widget(form) }}
  12. {{ form_end(form) }}
  13. {% endblock %}


Jak zmienić wygląd renderowanego pola 'task' ? chciałbym dodać klasy itp. ?

Ten post edytował Randallmaster 30.08.2015, 18:13:03
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 3)
ohm
post
Post #2





Grupa: Zarejestrowani
Postów: 623
Pomógł: 144
Dołączył: 22.12.2010

Ostrzeżenie: (0%)
-----


Wystarczy użyć google
https://stackoverflow.com/questions/6734821...ony2-form-input
Go to the top of the page
+Quote Post
Randallmaster
post
Post #3





Grupa: Zarejestrowani
Postów: 677
Pomógł: 11
Dołączył: 18.11.2009

Ostrzeżenie: (0%)
-----


Może dokładniej renderowany podstawowy wygląd z symfony:

  1. <div>
  2. <label for="form_task" class="required">Task</label>
  3. <input type="text" id="form_task" name="form[task]" required="required" class="calendar" value="Write a block post">
  4. </div>


a ja potrzebuje mniej więcej coś takiego:

  1. <div class="col-md-6">
  2. <div class="form-group">
  3. <label class="control-label col-md-3">Wyświetlanie<span class="font-red-sunglo">*</span></label>
  4. <div class="col-md-9">
  5. <input name="display_name" class="form-control required" id="display_name" value="" maxlength="125" onfocus="this.select()" type="text" placeholder="" data-original-title="Wypełnij pole!" data-trigger="manual">
  6. <span class="help-block">Nazwa wyświetlana</span>
  7. </div>
  8. </div>
  9. </div>


Ten post edytował Randallmaster 30.08.2015, 18:33:59
Go to the top of the page
+Quote Post
seeba
post
Post #4





Grupa: Zarejestrowani
Postów: 11
Pomógł: 1
Dołączył: 28.01.2010

Ostrzeżenie: (0%)
-----


How to Customize Form Rendering
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 21.08.2025 - 07:50