Hello,,
I'm having problem using modalBox. I have a work autocomplete in add
user script. But when i combined it using modalbox, it doesn't work.
If I access it normally, it worked. Can someone help?
##############################
autocomplete()
##############################
function autoComplete(){
$this->set('groups', $this->User->Group->find('all', array(
'conditions' => array(
'Group.name LIKE' =>
$this->data['Group']['name'].'%'
),
'fields' => array('name', 'id')
)));
//$this->layout = 'ajax';
}
##############################
add.ctp
##############################
<?php
if (isset($closeModalbox) && $closeModalbox) echo "<div
id='closeModalbox'></div>";
if ($ajax->isAjax()) {
echo $ajax->form('edit', 'post', array(
'model' => 'User',
'url' => array('controller' => 'users', 'action' => 'add'),
'update' => 'MB_content',
'complete' => 'closeModalbox()'
));
}else{
echo $this->Form->create('User');
}
?>
<fieldset>
<legend><?php __('Add User'); ?></legend>
<?php
echo $this->Form->input('username');
echo $this->Form->input('password');
echo __('Group');
echo $ajax->autoComplete('Group.name', '/users/autoComplete',
array('frequency' => '0.6', 'afterUpdateElement' => 'setValuesId'));
echo $this->Form->input('group_id', array('type' => 'hidden'));
?>
</fieldset>
<?php
echo $this->Form->end('Submit', array('class' => 'MB_focusable'));
?>
My reference of doing this is
http://nerdnotes.org/2008/02/combining-modalbox-cakephp/.
--
Regards,,,
mastanto
http://www.mastanto.com
http://thom-sharing.blogspot.com
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php