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
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<?php
echo $this->headScript();
?>
</head>
<body class="tundra">
<h1>
<?php echo $this->placeholder('title') ?></h1>
<?php echo $this->layout()->content ?>
<br />
<br />
</body>
indexControler
<?php
require_once '../library/test.php';
class IndexController extends Zend_Controller_Action
{
function init()
{
$this->initView();
$this->view->baseUrl = $this->_request->getBaseUrl();
}
function indexAction()
{
$form = new testDojoForm();
$this->view->form = $form;
}
}
?>
index (widok)
Formularz
<?php
echo $this->dojo()->addStylesheet('scripts/dojo/dojo/resources/dojo.css'); echo $this->dojo()->addStylesheetModule('dijit.themes.thundra'); ?>
library/test.php
<?php
require_once ('ZendDojoForm.php');
class testDojoForm extends Zend_Dojo_Form {
public function init() {
// Setup form
$this->setAction($this->getView()->url())->setMethod('post');
$this->setName('Name');
$this->addAttribs(array('onSubmit'=>'return validate(this)'));
// Meeting reciept field
$name = $this->createElement('ValidationTextBox', 'name',
array('regExp' => '[a-zA-Z]+', 'require' => 'true',
'InvalidMessage' => 'Invalid meeting recipient name'
)
);
$name->addValidator(new Zend_Validate_Alpha());
$name->setLabel('Name')->setRequired(true);
// Date feild
$date = $this->createElement('DateTextBox', 'date',
array('require' => 'true', 'InvalidMessage'=>'Invalid date format'
)
);
$date->setLabel('date')->setRequired(true);
// Submit button
$submit = $this->createElement('SubmitButton', 'submit',
array('required' => false, 'ignore' => true )
);
// Add elements to form
$this->addElements(array($name, $date, $submit )
);
}
}
?>