All posts tagged cakep

Undefined variable: javascript in cakePHP with scriptaculous

Today i am trying to use ajax call in cakephp.

<?php  echo $ajax->submit('Submit', array('url'=> array('controller'=>'users', 'action'=>'add'), 'update' => 'testdiv')); ?>

I found this error:

Undefined variable: Javascript

After a couple of searching I found the following things can cause this problem:

1. You do not have the html, javascript and ajax helper defined in your own controller (eg. user_controller.php)

var $helpers = array('Html','Javascript','Ajax'); 

2. Your render action points to a view where no view file is existing for. ( so the view file HAS to be created!


Hope it helps somebody who is experiencing the same problem I had.