Tuesday, December 30, 2008

Re: AJAX Helper form submit issue

Dominic
i am having the exact same prob .. i have searched through a lot of
tutorials but couldn't find even a single solution for this.
in my case i can see that the event is being triggered but the $this-
>params['form'] is empty just like as in your case.
i tried both of the following with out any luck :

$ajax->submit('submit', array('url' => '/submissions/add/', 'update'
=> 'mydiv')); [generating submit button]
$ajax->form('/submissions/add', 'post', array
('update'=>'mydiv','url'=>'/submissions/add')); [creating form tag ]

$this->data is also seems empty too .
i am stuck at it so badly.
can i expect any solution form any one please ??


On Dec 19, 1:13 am, "Dominic K." <dkerch...@gmail.com> wrote:
> I am having a problem with my AJAX form submit and can't quite see a
> solution in the groups. I also couldn't find any recent (~2008)
> tutorials on getting AJAX to work in CakePHP. I have seen some people
> who have just gone on to use JQuery, but I'd rather not.
>
> My problem is that the form data never makes it to the controller
> ($this->data, $this->params['data'] and $this->params['form'] are
> empty.
>
> I have enabled the JS and AJAX helpers as well as the RequestHandler
> component. I added <?php
> echo $javascript->link('prototype');
> echo $javascript->link('scriptaculous.js?load=effects')
> ?> in the head of the default.ctp.
>
> The div I am updating displays the echos and debugs in my controller,
> so I know the action is triggering. Below is my view. It basically
> allows the assignment of a one to many relationship (Project has many
> Stuff, Stuff has one Project). Any ideas what I could be missing or
> have some clues as how I can trace the issue?
>
> -------------------
>         <div id="west">
>
>     <fieldset>
>     <legend>Projects</legend>
>         <table id="worksheet">
>                 <?php echo $this->renderElement('active_filters');?>
>         <?php
>             $form_params = array('update' => 'status',
> 'model'=>'Project', 'url' => array('controller' => 'projects',
> 'action' => 'assign'));
>                         echo $ajax->form('assign','post', $form_params);
>                 ?>
>
>         <?php
>                 $options  = array('legend'=>'','div'=>true,'separator'=>'<br />','value'=>'');
>
>                 echo $form->radio('Project.id', $projects, $options);
>          ?>
>                 </fieldset>
>     </table>
>         </div>
>
>     <div id="east">
>     <table id="worksheet">
>             <tr height="20">
>             <td class="last">
>
>                 <?php
>                         $options  = array('multiple'=>'checkbox');
>                         echo $form->select('Stuff.id', $unassigned_stuff,
> null, $options);
>                 ?>
>             </td>
>             </tr>
>         </table>
>         </div>
>
> -------------
>
> Here is the dump of the $this->params array:
> Array
> (
>     [pass] => Array
>         (
>         )
>
>     [named] => Array
>         (
>         )
>
>     [controller] => projects
>     [action] => assign
>     [plugin] =>
>     [url] => Array
>         (
>             [ext] => html
>             [url] => projects/assign
>         )
>
>     [form] => Array
>         (
>         )
>
>     [isAjax] => 1
> )
>
> ----------
> Here's the form created by the helper:
>
>         <form id="form1937661850" onsubmit="event.returnValue = false;
> return false;" method="post" action="/app_name/projects/
> assign"><fieldset style="display:none;"><input type="hidden"
> name="_method" value="POST" /></fieldset><script type="text/
> javascript">
> //<![CDATA[
> Event.observe('form1937661850', 'submit', function(event) { new
> Ajax.Updater('status','/app_name/projects/assign', {asynchronous:true,
> evalScripts:true, parameters:Form.serialize('form1937661850'),
> requestHeaders:['X-Update', 'status']}) }, false);
> //]]>
> </script>
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: