I am no expert so you may get other answers that provide a detailed
explanation but this is what I user for my AJAX forms and it works error
free.
You can add / remove the options as you wish
echo $ajax->submit('Submit ', array(
'url' => 'your destination',
'update' => 'div you update or you can use the before or
after to add new item somewhere',
'class' => '....',
'loading'=> '....',
'loaded'=> '....',
'complete' => '...........'
));
Dave
-----Original Message-----
From: Stu [mailto:[email protected]]
Sent: March-18-09 10:51 AM
To: CakePHP
Subject: Getting started with Ajax Forms
Does anyone know a good/reliable source to get started with Ajax forms. The
cookbook's version seems incomplete and all the tutorials out there (or the
ones I could find) seem to be outdated.
I just want the standard most simple way to send a frm using ajax (add/
edit) from the same controller, nothing fancy.
I seem to be able to make it work on some levels (still saves the
data) but I get a bunch of warnings/errors and it doesn't redirect me
properly.
errors/notices I'm getting:
Notice (8): Undefined index: controller [CORE\cake\dispatcher.php, line
427]
Notice (8): Undefined index: controller [CORE\cake\dispatcher.php, line
141]
Warning (2): Cannot modify header information - headers already sent by
(output started at C:\web-dev\www\cake\cake\basics.php:313) [CORE
\cake\libs\session.php, line 407]
Warning (2): Cannot modify header information - headers already sent by
(output started at C:\web-dev\www\cake\cake\basics.php:313) [APP
\controllers\components\book_auth.php, line 269]
view code:
<div class="programs form">
<?php
echo $ajax->form('add', 'post', array(
'model'=>'Foo',
'update'=>'content')); ?>
<fieldset>
<legend><?php __('Add Foo');?></legend>
<?php
echo $form->input('name');
echo $form->input('acronym');
echo $form->input('offered');
?>
</fieldset>
<?php echo $form->end('Submit'); ?>
</div>
PS: I didn't make any changes in my controller (straight from the bake
script )
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---