I’m tying the code below. When the test() JS function is called by an
"onchange" event everything works as intended and dijit.byId is
defined but I get the error  “dijit is undefined” for “onload”. What
did I miss or do wrong? Many thanks for advices in advance.

In the View:

<?php
$this->dojo()->enable()
    ->setDjConfigOption('parseOnLoad', true);

$this->dojo()->javascriptCaptureStart();
?>
function test() {
    alert(dijit.byId("id"));
}
<?php
$this->dojo()->javascriptCaptureEnd();

$this->dojo()->onLoadCaptureStart();
?>
alert(dijit.byId("id"));
<?php
$this->dojo()->onLoadCaptureEnd();

echo $this->form;
?>

In the Form:

$this->addElement(
...
array(
'onchange' => 'test()',
)
);

Reply via email to