Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [ZendFramework] Zamiana kolejności pól formularza
nexis
post
Post #1





Grupa: Zarejestrowani
Postów: 1 012
Pomógł: 109
Dołączył: 26.09.2003
Skąd: nexis.pl

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


Tworzę formularz za pomocą Zend_Form:
  1. foreach ($optional as $key) {
  2. $this->addElement('checkbox', $key, array(
  3. 'required' => false,
  4. 'value' => '1'
  5. ));
  6. }

który generuje mniej więcej taki kod:
  1. <dl>
  2. <dt id="firstname-label">
  3. <label for="firstname" class="optional">
  4. Jan
  5. </label>
  6. </dt>
  7. <dd id="firstname-element">
  8. <input type="hidden" name="firstname" value="0" /><input type="checkbox" name="firstname" id="firstname" value="1" checked="checked" />
  9. </dd>
  10. <dt id="lastname-label">
  11. <label for="lastname" class="optional">
  12. Kowalski
  13. </label>
  14. </dt>
  15. <dd id="lastname-element">
  16. <input type="hidden" name="lastname" value="0" /><input type="checkbox" name="lastname" id="lastname" value="1" checked="checked" />
  17. </dd>
  18. </dl>

Powyższy kod daje taki widok:
(IMG:http://images39.fotosik.pl/195/18378e258f04e0bd.png)
Ja chciałbym jednak uzyskać następujący widok:
(IMG:http://images37.fotosik.pl/194/56bc7142ea2686b7.png)

Za pomocą CSS chyba nie da rady, ponieważ element DT jest przed DD, stąd pomysł, żeby te dwa elementy zamienić kolejnością. Ale jak?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 4)
seth-kk
post
Post #2





Grupa: Zarejestrowani
Postów: 444
Pomógł: 79
Dołączył: 26.05.2009

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


za pomoca css:
  1. .zend_form {
  2. overflow: hidden;
  3. }
  4. .zend_form dt {
  5. width: 25%;
  6. float: right;
  7. clear: right;
  8. }
  9. .zend_form dd {
  10. width: 75%;
  11. float: right;
  12. }

lub zamieniajac wartosci 'tag' w Zend_Form_Decorator_Label i Zend_Form_Decorator_HtmlTag
Go to the top of the page
+Quote Post
batman
post
Post #3





Grupa: Moderatorzy
Postów: 2 921
Pomógł: 269
Dołączył: 11.08.2005
Skąd: 127.0.0.1




Takie coś możesz uzyskać ustawiając placement na APPEND lub PREPEND w dekoratorze. Nie pamiętam dokładnie, w którym miejscu to się robi, musiałbyś sprawdzić w dokumentacji.
Go to the top of the page
+Quote Post
nexis
post
Post #4





Grupa: Zarejestrowani
Postów: 1 012
Pomógł: 109
Dołączył: 26.09.2003
Skąd: nexis.pl

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


Cytat(seth-kk @ 14.09.2009, 13:23:11 ) *
za pomoca css:
  1. .zend_form {
  2. overflow: hidden;
  3. }
  4. .zend_form dt {
  5. width: 25%;
  6. float: right;
  7. clear: right;
  8. }
  9. .zend_form dd {
  10. width: 75%;
  11. float: right;
  12. }

To nie działa.
Cytat(seth-kk @ 14.09.2009, 13:23:11 ) *
za pomoca css:
  1. .zend_form {
  2. overflow: hidden;
  3. }
  4. .zend_form dt {
  5. width: 25%;
  6. float: right;
  7. clear: right;
  8. }
  9. .zend_form dd {
  10. width: 75%;
  11. float: right;
  12. }

lub zamieniajac wartosci 'tag' w Zend_Form_Decorator_Label i Zend_Form_Decorator_HtmlTag

A co mi da zmiana tagu? Nadal kolejność będzie taka sama.
Go to the top of the page
+Quote Post
seth-kk
post
Post #5





Grupa: Zarejestrowani
Postów: 444
Pomógł: 79
Dołączył: 26.05.2009

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


Cytat(nexis @ 14.09.2009, 23:36:26 ) *
To nie działa.

przed wklejeniem sprawdzilem i dzialalo (xhtml 1.0 strict)

Cytat(nexis @ 14.09.2009, 23:36:26 ) *
A co mi da zmiana tagu? Nadal kolejność będzie taka sama.

zapomnialem o prepend dla labela co uzupelnil batman
Go to the top of the page
+Quote Post

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: 25.08.2025 - 04:53