Hello Alessio,

If i understood it correctly, then you are having a comments box where the
user posts comment, after he posted the comment you want to update comments
area without updating the page, right? if thats the case, then i am also
stuck with a same problem. My question is that how do you deal with error
case? Lets say that the validation failed while adding the comment, then you
cant update the comments area, you have to show error some where else(say on
the top of comments box). How do you handle this situation?

Thanks.

On Thu, Jun 12, 2008 at 10:56 PM, Alessio <[EMAIL PROTECTED]> wrote:

>
> Because I love this community and I want to help nexts with this
> problem...
> Don't try to update two fields...
>
> A good solution is use javascript code function, using the complete
> trigger;
>
> <?php echo $ajax->form('/comments/add', 'post', array( 'url' => '/
> comments/add', 'update' => 'feed','complete'=>"update2divs()" /
> *'indicator' => 'commentSaved'*/));?>
>
>
> On complete I call my function called update2divs
>
> In my file of javascript i have this function:
>
>
> function update2divs() {
>
> new Ajax.Updater('PostsComments', root + '/tests/hello',
> { method: 'post',
>  insertion: Insertion.Bottom });
>
> }
>
> Interesting solution...
> Because I can call my function and append the html in bottom or top...
>
> The root is a general var, because, i have my root site in
> subfolder...and when you upload in your site...
> THat all...
> So I can update my div, and give feedback to user of some error...and
> if completed succefully the request...
> I append the data to the div...without refreshing all the page.. but
> simply append the data...
>
> I cannot immagine a better solution, considering not spending
> resources in the server...
>
> So if you want to complete the cake, it would be interesting to put
> focus on the div...but i have read that exists some problem with
> different browser....
>
> Good job...
>
>
>
>
>
>
> On 12 Giu, 17:42, Alessio <[EMAIL PROTECTED]> wrote:
> > <?php echo $ajax->form('/comments/add', 'post', array( 'url' => '/
> > comments/add', 'update' => 'feed', 'indicator' => 'commentSaved'));?>
> >
> > I tried many option to update more div...
> > for example putting 'update' =>array.....
> > But is it possible?
> >
> > How can I to say to cake to create two update div?
> > In one, I need show the comments...
> > And in the other div I need to show the message "saved" or "error";
> >
> > I can use also javascript:
> >
> > function update2divs(parameters) {
> >     ajaxupdate('div1','url');
> >     ajaxupdate('div2','url2');
> >
> > }
> >
> > But How can I call this function, using $ajax->form?
> >
> > Another question, how can I move the focus on a div...I need to show
> > the comment when the user has finished posting the comment.
> >
> > Very thanks.
> >
>


-- 
Thanks & Regards,
Novice.

--~--~---------~--~----~------------~-------~--~----~
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