[symfony-users] Re: Saving request? (ajax)
$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. Gareth On Tue, Mar 17, 2009 at 7:51 PM, Liran Tal liran@gmail.com wrote: On Mar 17, 4:22 pm, Gareth McCumskey gmccums...@gmail.com 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 liran@gmail.com 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=AuthorAuthor:/label ?php echo input_tag('author') ? label for=TalkbackTalkback:/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 symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Saving request? (ajax)
Hey Gareth, On Mar 18, 11:34 am, Gareth McCumskey gmccums...@gmail.com 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 liran@gmail.com wrote: On Mar 17, 4:22 pm, Gareth McCumskey gmccums...@gmail.com 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 liran@gmail.com 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=AuthorAuthor:/label ?php echo input_tag('author') ? label for=TalkbackTalkback:/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 symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Saving request? (ajax)
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 liran@gmail.com wrote: Hey Gareth, On Mar 18, 11:34 am, Gareth McCumskey gmccums...@gmail.com 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 liran@gmail.com wrote: On Mar 17, 4:22 pm, Gareth McCumskey gmccums...@gmail.com 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 liran@gmail.com 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=AuthorAuthor:/label ?php echo input_tag('author') ? label for=TalkbackTalkback:/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 symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Saving request? (ajax)
Did you actually look in the database to see if it saved the object or not? Also to get that array what you need to do is after the save(): $this-results = array(author=$talback_obj-getAuthor(), body=$talback_obj-getBody()); But you do not even need to do this. Just do: $this-results = $talkback_obj; Then in your view you can access the object directly: ?php echo $talkback_obj-getAuthor(); ? ?php echo $talkback_obj-getBody(); ? To debug that problem you are having with Ajax updating the correct div post the entire form_remote_tag function snippet for me to see... Gareth On Wed, Mar 18, 2009 at 4:07 PM, Liran Tal liran@gmail.com wrote: Hey Gareth, On Mar 18, 11:34 am, Gareth McCumskey gmccums...@gmail.com 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 liran@gmail.com wrote: On Mar 17, 4:22 pm, Gareth McCumskey gmccums...@gmail.com 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 liran@gmail.com 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=AuthorAuthor:/label ?php echo input_tag('author') ? label for=TalkbackTalkback:/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 symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Saving request? (ajax)
Another tip. I would seriously recommend you look at doing the Jobeet tutorial as it covers this and more in such fantastic detail and will get you to grips with symfony very quickly. Gareth On Wed, Mar 18, 2009 at 6:19 PM, Gareth McCumskey gmccums...@gmail.comwrote: Did you actually look in the database to see if it saved the object or not? Also to get that array what you need to do is after the save(): $this-results = array(author=$talback_obj-getAuthor(), body=$talback_obj-getBody()); But you do not even need to do this. Just do: $this-results = $talkback_obj; Then in your view you can access the object directly: ?php echo $talkback_obj-getAuthor(); ? ?php echo $talkback_obj-getBody(); ? To debug that problem you are having with Ajax updating the correct div post the entire form_remote_tag function snippet for me to see... Gareth On Wed, Mar 18, 2009 at 4:07 PM, Liran Tal liran@gmail.com wrote: Hey Gareth, On Mar 18, 11:34 am, Gareth McCumskey gmccums...@gmail.com 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 liran@gmail.com wrote: On Mar 17, 4:22 pm, Gareth McCumskey gmccums...@gmail.com 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 liran@gmail.com 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=AuthorAuthor:/label ?php echo input_tag('author') ? label for=TalkbackTalkback:/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 symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Saving request? (ajax)
On Mar 18, 6:19 pm, Gareth McCumskey gmccums...@gmail.com wrote: Did you actually look in the database to see if it saved the object or not? Yes, I checked, it doesn't save the information to the database. Also to get that array what you need to do is after the save(): $this-results = array(author=$talback_obj-getAuthor(), body=$talback_obj-getBody()); But you do not even need to do this. Just do: $this-results = $talkback_obj; Then in your view you can access the object directly: ?php echo $talkback_obj-getAuthor(); ? ?php echo $talkback_obj-getBody(); ? Ok, I changed the code so that the results member stores the object itself. To debug that problem you are having with Ajax updating the correct div post the entire form_remote_tag function snippet for me to see... There it is: ?php use_helper('Javascript'); ? ?php use_helper('Form'); ? ... input type=hidden name=blog_id id=blog_id value=?php echo $blog-getId(); ? / label for=AuthorAuthor:/label ?php echo input_tag('author') ? br/ label for=TalkbackTalkback:/label ?php echo input_tag('talkback') ? ?php echo submit_tag('Post') ? /form Thanks. Gareth On Wed, Mar 18, 2009 at 4:07 PM, Liran Tal liran@gmail.com wrote: Hey Gareth, On Mar 18, 11:34 am, Gareth McCumskey gmccums...@gmail.com 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 liran@gmail.com wrote: On Mar 17, 4:22 pm, Gareth McCumskey gmccums...@gmail.com 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 liran@gmail.com 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=AuthorAuthor:/label ?php echo input_tag('author') ? label for=TalkbackTalkback:/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
[symfony-users] Re: Saving request? (ajax)
Oh silly me! I think I forgot to enable javascript support for the prototype library in app/frontend/config/view.yml as I just remembered I didn't do that and I believe that this is the problem. Checking and I'll report back! On Mar 18, 6:20 pm, Gareth McCumskey gmccums...@gmail.com wrote: Another tip. I would seriously recommend you look at doing the Jobeet tutorial as it covers this and more in such fantastic detail and will get you to grips with symfony very quickly. Gareth On Wed, Mar 18, 2009 at 6:19 PM, Gareth McCumskey gmccums...@gmail.comwrote: Did you actually look in the database to see if it saved the object or not? Also to get that array what you need to do is after the save(): $this-results = array(author=$talback_obj-getAuthor(), body=$talback_obj-getBody()); But you do not even need to do this. Just do: $this-results = $talkback_obj; Then in your view you can access the object directly: ?php echo $talkback_obj-getAuthor(); ? ?php echo $talkback_obj-getBody(); ? To debug that problem you are having with Ajax updating the correct div post the entire form_remote_tag function snippet for me to see... Gareth On Wed, Mar 18, 2009 at 4:07 PM, Liran Tal liran@gmail.com wrote: Hey Gareth, On Mar 18, 11:34 am, Gareth McCumskey gmccums...@gmail.com 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 liran@gmail.com wrote: On Mar 17, 4:22 pm, Gareth McCumskey gmccums...@gmail.com 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 liran@gmail.com 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=AuthorAuthor:/label ?php echo input_tag('author') ? label for=TalkbackTalkback:/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
[symfony-users] Re: Saving request? (ajax)
Ok, some update. 1. Obviously I was missing that directive for the javascripts to be enabled, so I added that but it didn't solve anything. 2. Debugging with FireBug I notice that the javascript files are printing an error message: You don't have permission to access /sfProtoculousPlugin/js/ prototype.js So now it sheds some light. At first it seems like the web server is mis-configured but digging a little bit further shows that my /var/www/proj/sf_sandbox/web directory includes the following symlink: sfProtoculousPlugin - ../../lib/plugins/sfProtoculousPlugin/web And trying to find the prototype javascript library it's located here: /var/www/proj/sf_sandbox/lib/symfony/plugins/sfProtoculousPlugin/web/ js/prototype.js So that seems a little bit off from the symlink. Is this a 1.2 sf_sandbox bug? I've fixed the symlinks and now javascript is enabled (I added an indicator also to the page so visually see it). 3. Last issue - I still can't get the results to be passed to the success template. Having var_dump($this-results); in the template result in the error of Notice: Undefined property: sfPHPView::$results Any thoughts on that? Regards, Liran. On Mar 18, 6:20 pm, Gareth McCumskey gmccums...@gmail.com wrote: Another tip. I would seriously recommend you look at doing the Jobeet tutorial as it covers this and more in such fantastic detail and will get you to grips with symfony very quickly. Gareth On Wed, Mar 18, 2009 at 6:19 PM, Gareth McCumskey gmccums...@gmail.comwrote: Did you actually look in the database to see if it saved the object or not? Also to get that array what you need to do is after the save(): $this-results = array(author=$talback_obj-getAuthor(), body=$talback_obj-getBody()); But you do not even need to do this. Just do: $this-results = $talkback_obj; Then in your view you can access the object directly: ?php echo $talkback_obj-getAuthor(); ? ?php echo $talkback_obj-getBody(); ? To debug that problem you are having with Ajax updating the correct div post the entire form_remote_tag function snippet for me to see... Gareth On Wed, Mar 18, 2009 at 4:07 PM, Liran Tal liran@gmail.com wrote: Hey Gareth, On Mar 18, 11:34 am, Gareth McCumskey gmccums...@gmail.com 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 liran@gmail.com wrote: On Mar 17, 4:22 pm, Gareth McCumskey gmccums...@gmail.com 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 liran@gmail.com 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=AuthorAuthor:/label ?php echo input_tag('author') ? label for=TalkbackTalkback:/label ?php echo input_tag('talkback') ? ?php echo submit_tag('Post') ?
[symfony-users] Re: Saving request? (ajax)
do var_dump($results); by saying $this-results you are in effect creating a variable $results for the view. On Wed, Mar 18, 2009 at 9:06 PM, Liran Tal liran@gmail.com wrote: Ok, some update. 1. Obviously I was missing that directive for the javascripts to be enabled, so I added that but it didn't solve anything. 2. Debugging with FireBug I notice that the javascript files are printing an error message: You don't have permission to access /sfProtoculousPlugin/js/ prototype.js So now it sheds some light. At first it seems like the web server is mis-configured but digging a little bit further shows that my /var/www/proj/sf_sandbox/web directory includes the following symlink: sfProtoculousPlugin - ../../lib/plugins/sfProtoculousPlugin/web And trying to find the prototype javascript library it's located here: /var/www/proj/sf_sandbox/lib/symfony/plugins/sfProtoculousPlugin/web/ js/prototype.js So that seems a little bit off from the symlink. Is this a 1.2 sf_sandbox bug? I've fixed the symlinks and now javascript is enabled (I added an indicator also to the page so visually see it). 3. Last issue - I still can't get the results to be passed to the success template. Having var_dump($this-results); in the template result in the error of Notice: Undefined property: sfPHPView::$results Any thoughts on that? Regards, Liran. On Mar 18, 6:20 pm, Gareth McCumskey gmccums...@gmail.com wrote: Another tip. I would seriously recommend you look at doing the Jobeet tutorial as it covers this and more in such fantastic detail and will get you to grips with symfony very quickly. Gareth On Wed, Mar 18, 2009 at 6:19 PM, Gareth McCumskey gmccums...@gmail.com wrote: Did you actually look in the database to see if it saved the object or not? Also to get that array what you need to do is after the save(): $this-results = array(author=$talback_obj-getAuthor(), body=$talback_obj-getBody()); But you do not even need to do this. Just do: $this-results = $talkback_obj; Then in your view you can access the object directly: ?php echo $talkback_obj-getAuthor(); ? ?php echo $talkback_obj-getBody(); ? To debug that problem you are having with Ajax updating the correct div post the entire form_remote_tag function snippet for me to see... Gareth On Wed, Mar 18, 2009 at 4:07 PM, Liran Tal liran@gmail.com wrote: Hey Gareth, On Mar 18, 11:34 am, Gareth McCumskey gmccums...@gmail.com 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 liran@gmail.com wrote: On Mar 17, 4:22 pm, Gareth McCumskey gmccums...@gmail.com 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 liran@gmail.com 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',
[symfony-users] Re: Saving request? (ajax)
On Mar 18, 9:08 pm, Gareth McCumskey gmccums...@gmail.com wrote: do var_dump($results); by saying $this-results you are in effect creating a variable $results for the view. Right, so at the action handler when doing $this-result it creates the result variable and assigns it the object? Ahh, I thought it was a member of the class. Anyway, Any ideas regarding those soft links in the sandbox? I'm pretty sure it's not something that I've changed myself so I'm guessing it's a bug in the sf_sandbox package. Thanks, Liran. On Wed, Mar 18, 2009 at 9:06 PM, Liran Tal liran@gmail.com wrote: Ok, some update. 1. Obviously I was missing that directive for the javascripts to be enabled, so I added that but it didn't solve anything. 2. Debugging with FireBug I notice that the javascript files are printing an error message: You don't have permission to access /sfProtoculousPlugin/js/ prototype.js So now it sheds some light. At first it seems like the web server is mis-configured but digging a little bit further shows that my /var/www/proj/sf_sandbox/web directory includes the following symlink: sfProtoculousPlugin - ../../lib/plugins/sfProtoculousPlugin/web And trying to find the prototype javascript library it's located here: /var/www/proj/sf_sandbox/lib/symfony/plugins/sfProtoculousPlugin/web/ js/prototype.js So that seems a little bit off from the symlink. Is this a 1.2 sf_sandbox bug? I've fixed the symlinks and now javascript is enabled (I added an indicator also to the page so visually see it). 3. Last issue - I still can't get the results to be passed to the success template. Having var_dump($this-results); in the template result in the error of Notice: Undefined property: sfPHPView::$results Any thoughts on that? Regards, Liran. On Mar 18, 6:20 pm, Gareth McCumskey gmccums...@gmail.com wrote: Another tip. I would seriously recommend you look at doing the Jobeet tutorial as it covers this and more in such fantastic detail and will get you to grips with symfony very quickly. Gareth On Wed, Mar 18, 2009 at 6:19 PM, Gareth McCumskey gmccums...@gmail.com wrote: Did you actually look in the database to see if it saved the object or not? Also to get that array what you need to do is after the save(): $this-results = array(author=$talback_obj-getAuthor(), body=$talback_obj-getBody()); But you do not even need to do this. Just do: $this-results = $talkback_obj; Then in your view you can access the object directly: ?php echo $talkback_obj-getAuthor(); ? ?php echo $talkback_obj-getBody(); ? To debug that problem you are having with Ajax updating the correct div post the entire form_remote_tag function snippet for me to see... Gareth On Wed, Mar 18, 2009 at 4:07 PM, Liran Tal liran@gmail.com wrote: Hey Gareth, On Mar 18, 11:34 am, Gareth McCumskey gmccums...@gmail.com 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 liran@gmail.com wrote: On Mar 17, 4:22 pm, Gareth McCumskey gmccums...@gmail.com 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.
[symfony-users] Re: Saving request? (ajax)
$talkback_obj = new Talkback(); $talkback_obj-setAuthor($author); $talkback_obj-setBody($talkback); $talkback_obj-save(); On Tue, Mar 17, 2009 at 4:10 PM, Liran Tal liran@gmail.com 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=AuthorAuthor:/label ?php echo input_tag('author') ? label for=TalkbackTalkback:/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 symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Saving request? (ajax)
On Mar 17, 4:22 pm, Gareth McCumskey gmccums...@gmail.com 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 liran@gmail.com 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=AuthorAuthor:/label ?php echo input_tag('author') ? label for=TalkbackTalkback:/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 symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---