hi all,
am using cake 1.2
   i need a call a function add() in my controller from my index.ctp
page.
the code goes like this
index.ctp
<?php echo $ajax->form('add');?>
                     <td width="30%"><?php echo $form->input
('new_role');?></td>
                    <td width="46%"><?php echo $form->end('Create');?
></td>

function in my controller
 function add() {
           echo 'SSSSSSS';
            Configure::write('debug', '0');     //turn debugging off;
debugging breaks ajax
            $this->layout = 'Ajax';
         if (!empty($this->data))
         {
             echo('$this->data');
             $this->Role->create();
             if ($this->Role->save($this->data))
             {
                /*$nroles = $this->Role->find('all', array
('conditions' => array('role_name'=>$this->data['Role']
['role_name']),'recursive'=>-1));
                $this->set(compact('nroles'));*/
                $this->render('index','ajax');
             } else {
             $this->render('add_failure','ajax');
             }
         }
    }



When i click on Create button with some value in the New Role text
box, my URL shows this
?data[Roles]=3&_method=POST&data[new_role]=agrgaqt

if nothing is entered in the Text Box, then i get
?data[Roles]=3&_method=POST&data[new_role]=


This is what i see in the View Page Source,
<form id="form141121669" onsubmit="event.returnValue = false; return
false;" method="post" action="/UOV/access_rules/add"><fieldset
style="display:none;"><input type="hidden" name="_method"
value="POST" /></fieldset><script type="text/javascript">
//<![CDATA[
Event.observe('form141121669', 'submit', function(event) { new
Ajax.Request('/UOV/access_rules/add', {asynchronous:true,
evalScripts:true, parameters:Form.serialize('form141121669')}) },
false);
//]]>
</script>                     <td width="30%"><div class="input
text"><label for="new_role">New Role</label><input name="data
[new_role]" type="text" value="" id="new_role" /></div></td>
                    <td width="46%"><div class="submit"><input
type="submit" value="Create" /></div></form></td>


In my firebug i see an error which says, Registry is not defined.
am using prototype.js
var respondersForEvent = registry.get(eventName); line 4441.

would really appreciate if somebosy threw a little light on this.
thank u :)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to