Hi,

> If I understand you right, it sounds like you may wish to go down the
> ajax route.
> In essence, have an action for the parent that renders all the stuff
> it needs to do,
> but has placeholders (div's) that you preload with child actions (ie a
> form).

  Thanks for your answer - I had a quick play with the Ajax method and
found that this is certainly a possibility, but as I am totally new to
Ajax I don't  want to start integrating it into a production site
without knowing a little more about the issues - security, browser
support, bugs, etc.  Part of this was running into issues with effects
very quickly.

  The problem I had originally with renderElement was because the data
was passed to the function, but the tree was different for my nested
structure and my non-nested edit form.  I also think there is a bug
with the renderElement that means that $html->tagValue or $html-
>input, etc does not "find" the data from the model, even if you get
the structure the same as you would for the proper view.  I am not
100% on this, so I need to investigate further before submitting a
report.

  What I did find was a workaround to create my nested editing views
using the original element method which is shown below - it may seem a
bit of a hack, but all I do is wrap up my elements with the view -
then I can use them elsewhere.

  It also makes for less unwieldy views because I split it up into
chunks.  It also means I could still quite easily switch my elements
over to Ajax ones by adding an if / else clause in the view and also
in the controller so that the same functions use Ajax or normal
functionality - this is why I need to read up a bit more too.

  Hope this helps anyone else looking for an idea.

  Anyway, my workaround is like this for my original view:

  <?php //views\child\admin_edit.thtml

    echo renderElement('child\my_admin_edit', array('fm_data' => $this-
>data['ChildModelName']));
 ?>

  For my nested views:

  <?php  //views\parent\admin_view.thml

    foreach($parent['ChildModel'] as $child) {

     echo renderElement('child\my_admin_edit',  array('fm_data' =>
$child));
   }
  ?>

For my element:

  <?php //elements\child\my_admin_edit.thtml
     ?>
    <form>
    <div class="required">
    <?php
       echo $html->input('ChildModelName/title', array('value' =>
$fm_data['title']));
    ?>
   </div>
   <!--ETC-->
   </form>
  ?>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to