So you've been able to load the add view into the div already?

Then you just need to change a few things in the add form:
// start the form
<form onsubmit="return false;">

// normal form fields

  <?php echo $html->input('MyModel/title', array('size' => '35'))?> //
etc

// ajax submit button

<?php
            if (!isset($complete)) $complete = '';
            $options = array(
                'url'       => ''url_for_submit',
                'update'    => 'div_to_update',
                'complete'  => $complete."some effects here
maybe...?");
            echo $ajax->submit('Save', $options);
            ?>

// end form
</form>

Now, if you submit the form, it is processed by the controller, just
like a non-ajax form, so in the controller for the add-action you go:

if ($this->MyModel->save($this->data))
            {

                        // now render the view as ajax
                        $this->render('view_to_render', 'ajax');

            }

Hope this helps,

Gerben.

On 11 apr, 16:38, "rstuker" <[EMAIL PROTECTED]> wrote:
> got the aim, but not the way, sorry. May you be so kind to show me a
> whole example? I've a form in a view (controllers/add) which contained
> <input> value to be entered, using <form action="$html->url(/
> controlers/add)"> ---$html->input('Model/fielname')... -- 
> $html->submit("save"). I loaded this view inside the div hidden using the
>
> echo $ajax->link('Link text', '/controllers/add'...), right?In the
> method of that controller, the usual
> "if (!empty($this->data['Jurado'])) {
>            if($this->Jurado->save($this->data['Jurado'])) { $this->flash(); 
> $this->log();}"
>
> Now..should i use $ajax->...for each option in my view representing
> each ModelName/fieldname?And how the controller will be told data is
> being,now, submitted by $ajax helper instead of $html?only $this->render();, 
> what should change in the Contr..?. I do apologise, i'm
>
> really newbie at php,cake.Do thanks!


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