If there’s somewhere a mystery bug contest I’m probably winning the race. Here’s a new one : try to get a view helper to work with javascript. Anyone has a solution ? Here’s my unworking code :

  1. class Zend_View_Helper_Loginbox extends Zend_View_Helper_Partial
  2. {
  3. public function loginbox()
  4. {
  5. $this->view->headScript()->appendFile(‘/scripts/js/myfile.js’);
  6. // this doesn’t work, the file never gets included
  7. $this->view->dojo()->javascriptCaptureStart();
  8. // neigher the content of my javascript function after this
  9. ?>
  10. dojo.addOnLoad(function(){
  11. alert(“it s working”);
  12. });
  13. view->dojo()->javascriptCaptureEnd(); ?>
  14. <div id=”box” class=”box”>test</div>
  15. <div id=”blockme” class=”blockme”>
  16. <form method=”post” action=”/user/login” id=”loginform”>
  17. <label for=”email”>Email:</label>
  18. <input type=”text” name=”email”>
  19. <label for=”password”></label>
  20. <input type=”password” name=”password”>
  21. <input type=”submit” id=”loginButton” value=”login”>
  22. <div id=”loginerrors”></div>
  23. </form>
  24. </div>

Javascript never get to be on the client server. Any idea why ?

Advertisements