I've also just noticed that while I use the ajax form submit method of
form_remote_tag()
then the output of the url (success page) isn't being placed in the
div id part but rather
it seems like it's just redirecting to that success page output...




On Mar 18, 4:07 pm, Liran Tal <[email protected]> wrote:
> Hey Gareth,
>
> On Mar 18, 11:34 am, Gareth McCumskey <[email protected]> wrote:
>
> > $request and $this->getRequest() and even
> > sfContext::getInstance()->getRequest() are all the same thing within the
> > action. Outside the action you won't be able to use $request, thats why all
> > the other access methods exist. $request in an action is just a convenience.
>
> Thanks for that reference, good to be on the right track.
> Regarding the $talkback_obj->save() method for saving the data, it
> doesn't seem
> to save the data. It doesn't give any error too, just shows me the
> ajax success page.
>
> More than that, I've also added this after the ->save() method:
>                   $results = array('author' => $author, 'body' => $body);
>                   $this->results = $results;
> And in the addNewTalkbackAjaxSuccess.php page I did this:
> <?php
>         var_dump($results);
> ?>
> (Because I know that it's possible to pass like that variables from
> the actions to the view
> so I wanted to check the values)
> but it gives me an error for undefined variable $results.
>
> This still doesn't explain why the talkback object save() method isn't
> saving the information
> (and it doesn't give any error if I don't use the $results variable on
> the view page so I'm clueless).
>
> I mentioned I'm using 1.2?
>
> Thanks.
>
> > Gareth
>
> > On Tue, Mar 17, 2009 at 7:51 PM, Liran Tal <[email protected]> wrote:
>
> > > On Mar 17, 4:22 pm, Gareth McCumskey <[email protected]> wrote:
> > > > $talkback_obj = new Talkback();
>
> > > > $talkback_obj->setAuthor($author);
> > > > $talkback_obj->setBody($talkback);
> > > > $talkback_obj->save();Thanks,
>
> > > Thanks,
> > > If you don't mind me asking also regarding the foThanks,llowing line
> > > of code
> > >          $isAjax = $this->getRequest()->isXmlHttpRequest();
> > > It seems to me that it's possible to use $request->isXmlHttpRequest()
> > > instead of $this?
> > > it makes sense that $this->getRequest() actually referes to the
> > > $request object in the function.
>
> > > > On Tue, Mar 17, 2009 at 4:10 PM, Liran Tal <[email protected]> wrote:
>
> > > > > Hey,
>
> > > > > In my template for showSuccess.php I've added the ability to submit a
> > > > > form via Ajax
> > > > > as follows:
> > > > >                <div id="talkback_list"></div>
> > > > >                <?php echo form_remote_tag(array(
> > > > >                                'update'   => 'talkback_list',
> > > > >                                'url'      =>
> > > 'talkback/addNewTalkbackAjax',
> > > > >                                ))
> > > > >                ?>
> > > > >                <label for="Author">Author:</label>
> > > > >                <?php echo input_tag('author') ?>
> > > > >                <label for="Talkback">Talkback:</label>
> > > > >                <?php echo input_tag('talkback') ?>
> > > > >                <?php echo submit_tag('Post') ?>
> > > > >                </form>
>
> > > > > And in the talkback module's actions I've added an execution handler
> > > > > for it, such as:
>
> > > > >  public function executeAddNewTalkbackAjax($request)
> > > > >  {
> > > > >          $isAjax = $this->getRequest()->isXmlHttpRequest();
> > > > >          if ($isAjax) {
> > > > >                  $author = $request->getParameter('author');
> > > > >                  $talkback = $request->getParameter('talkback');
>
> > > > >                 .... save(); ...
>
> > > > >          }
> > > > >  }
>
> > > > > My question is how to save this data (author and talkback) in the
> > > > > table from this execution
> > > > > handler?
>
> > > > > Reference: related schema:
> > > > >  talkback:
> > > > >    _attributes:  { phpName: Talkback }
> > > > >    id:           ~
> > > > >    blog_id:   ~
> > > > >    author:       varchar(250)
> > > > >    body:         longvarchar
> > > > >    created_at:   ~
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" 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/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to