Difference between #12 and #13 of
CJuiDialog and AjaxSubmitButton

Revision #13 has been created by phazei on Jul 28, 2011, 7:20:49 PM with the memo:

Added scriptMap to prevent jquery.js from loading and a note about it. Also corrected a bit of grammar.
« previous (#12)

Changes

Title unchanged

CJuiDialog and AjaxSubmitButton

Category unchanged

Tutorials

Yii version unchanged

Tags unchanged

AJAX

Content changed

[...]
The ajaxLink will call an action in the JobController with name ActionAddnew ( we will call it Addnew from now on ), which will either save the job ( after validation ) either rendering the job form.
###3. _FormDialog:
Finally, the job form which consist of a create.php view and a _formDialog.php view, both exist under under job/views/.
The _formDialog.php ( we will call it _formDialog from now on ) will contain an ajaxSubmitButton to submit the Job we want to create.
##Code and details
Now, I don't know from where exactly
should start to make it more easyeasier for you.  I assume you have a little experience with ajaxLink etc al., though iI will try to be as much detailed as iI can.

### _form. The person's create form.
[...]
}
if($flag) {
                    Yii::app()->clientScript->scriptMap['jquery.js'] = false;
 
$this->renderPartial('createDialog',array('model'=>$model,),false,true); } } ```~ ####Where to pay attention: I think thisThe scriptMap parameter is essential.  Without that line, jquery.js will be loaded again and can cause issues with javascript both already existing on the page, as well as duplicated event handlers for ajax calls run multiple times that contain their own javascript.  You may want to use scriptMap to prevent other js files from loading again using '*.js' as the array key.
 
 
I think the rest
is straightforward. Pay attention the last 2 parameters of [renderPartial](http://www.yiiframework.com/doc/api/CController#renderPartial-detail)
We call first the `createDialog.php` from `job/views/` which is the following.

### createDialog.php
~
```php
[...]
33 1
46 followers
Viewed: 106 121 times
Version: 1.1
Category: Tutorials
Tags: AJAX
Written by: tydeas_dr
Last updated by: phazei
Created on: May 11, 2010
Last updated: 6 years ago
Update Article

Revisions

View all history