Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [ZendFramework] dojo Form
Forum PHP.pl > Forum > PHP > Frameworki
phpsuse
Witam,
Wstawiłem przykład Formularza z przykładu filmu Dojo.
Formularz dział pokazuje sie. Jak wpisuje niedozwolone znaki lub wybieram date. wywołuje sie JS ale na dole strony i nie sformatowane. Nie tak jak na filmie.
Podejrzewam że nie ładują sie CSS. Czy to może być przyczyna ?

Przemek

layout.phtml
  1. <html>
  2.  
  3.    <head>
  4.        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5.        <?php
  6.        echo $this->headTitle();
  7.        echo $this->headScript();
  8.        echo $this->headStyle();
  9.        echo $this->dojo();
  10.      
  11.        ?>
  12.    </head>
  13.    
  14.    <body class="tundra">
  15.        <h1><?php echo $this->placeholder('title') ?></h1>
  16.                <?php echo $this->layout()->content ?>
  17.        
  18.        <br />
  19.        <br />
  20.    </body>


indexControler
  1. <?php
  2. require_once '../library/test.php';
  3.  
  4. class IndexController extends Zend_Controller_Action
  5. {
  6.  
  7.    function init()
  8.    {
  9.        $this->initView();
  10.        $this->view->baseUrl = $this->_request->getBaseUrl();
  11.    }
  12.    
  13.    
  14.    function indexAction()
  15.    {
  16.        $form = new testDojoForm();
  17.        $this->view->form = $form;
  18.    }
  19.  
  20.  
  21. }
  22. ?>


index (widok)
  1. Formularz
  2. <?php
  3.    echo $this->dojo()->addStylesheet('scripts/dojo/dojo/resources/dojo.css');
  4.    echo $this->dojo()->addStylesheetModule('dijit.themes.thundra');
  5.    echo $this->form;
  6.    echo $this->message;
  7. ?>


library/test.php

  1. <?php
  2.  
  3. require_once ('ZendDojoForm.php');
  4.  
  5. class testDojoForm extends Zend_Dojo_Form {
  6.    
  7.    public function init() {
  8.        
  9.        // Setup form
  10.        $this->setAction($this->getView()->url())->setMethod('post');
  11.        $this->setName('Name');
  12.        $this->addAttribs(array('onSubmit'=>'return validate(this)'));
  13.        
  14.        // Meeting reciept field
  15.        $name = $this->createElement('ValidationTextBox', 'name',
  16.                array('regExp' => '[a-zA-Z]+',
  17.                'require' => 'true',
  18.                'InvalidMessage' => 'Invalid meeting recipient name'
  19.            )
  20.        );
  21.        $name->addValidator(new Zend_Validate_Alpha());
  22.        $name->setLabel('Name')->setRequired(true);
  23.        
  24.        // Date feild
  25.        $date = $this->createElement('DateTextBox', 'date',
  26.                array('require' => 'true',
  27.                'InvalidMessage'=>'Invalid date format'
  28.            )
  29.        );
  30.        $date->setLabel('date')->setRequired(true);
  31.        
  32.        // Submit button
  33.        $submit = $this->createElement('SubmitButton', 'submit',
  34.            array('required' => false, 'ignore' => true
  35.            )
  36.        );
  37.            
  38.        // Add elements to form
  39.        $this->addElements(array($name, $date, $submit
  40.            )
  41.        );
  42.        
  43.    }
  44. }
  45.  
  46. ?>
ert16
[quote name='phpsuse' date='16.07.2009, 12:21:00 ' post='635076']

  1. <html>
  2.  
  3.    <head>
  4.        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5.        <?php
  6.        echo $this->headTitle();
  7.        echo $this->headScript();
  8.        echo $this->headStyle();
  9.        echo $this->dojo();
  10.      
  11.        ?>
  12.    </head>
  13. [..]
  14.    </body>

Czy specjalnie ominąłeś, czy zapomniałeś :
  1. <?php
  2. echo $this->headLink();
  3. ?>

Z tego co pamiętam to DOJO używa tego pośrednio.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.