I am experiencing some very odd behavior with the Ajax helper.

I have a page with the following structure

index.ctp
---------
<?php
    echo $ajax->form('view','post', array('update' => 'view_box') );
    echo $form->submit('Display View');
    echo $form->end();
?>
<div id="view_box">
This is where the view should be.
</div>
--------

The view action generates the following code which then appears in the
view_box div:

view.ctp
---------------
<?php
    echo $ajax->form('view_two','post', array('update' =>
'view_box') );
    echo $form->submit('Display View');
    echo $form->end();
?>
-----------------
The problem is that when I now click on the form's submit button
NOTHING happens.

However if I modify the page to include an ajax link:

view.ctp
------------------------
<?php
    echo $ajax->link('display view_two', '/ajax_tests/view_two',
array('update' => 'view_box') );
    echo $ajax->form('view_two','post', array('update' =>
'view_box') );
    echo $form->submit('Display View');
    echo $form->end();
?>
------------------------

Now, both the link and the form submit button have the desired effect
of reloading the parent div with the content generated by view_two.

Does anyone know what is going on here?  Why does the mere presence of
the $ajax->link() on the page all of a sudden allow the ajax form to
start working?

Is this an Ajax issue or is it an issue with Cake's helper?
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to