Jump to content

Recommended Posts

I'm trying to install comments on two of my clients' websites. In both cases, I'm able to display the comment submission form, but the form submissions are not being saved or display. Once I click the submit button, I'm directed to the homepage where #CommentForm is appended to the end of the URL. I have looked through countless forums and Google searches, but I can't find any advice that has fixed this issue. I have followed the instructions from https://processwire.com/docs/modules/guides/comments/ exactly as described, and I'm getting no where.

Like I said, this is set up on two different websites and I'm seeing the same issues with both. I assume it's some issue with connecting with a database, but I don't see anything in the instructions on PW's website that says I need to do anything there.

Share this post


Link to post
Share on other sites

Hi @Rhen GWL and welcome to the PW forums.

By any chance do you have the template setting "Should page URLs end with a slash?" set to "No"?

2019-04-30_110712.png.a9750fe8950143f5558e3cfefa92625d.png

There seems to be an issue with the default action of the comments form that will submit the form to the parent page if the current page has no trailing slash.

I opened a GitHub issue here, and in the meantime until Ryan responds you can override the default form action in the $options array for renderForm():

echo $page->comments->renderForm(array('attrs' => array('action' => $page->url)));

 

Share this post


Link to post
Share on other sites

This is probably too basic of answer, but I believe you can install the "Regular Blog" (site-regular) Profile that comes with Processwire on a test site to see and test how comments work.  You can also compare your code with it.

You can read more about it at https://processwire.com/blog/posts/introducing-a-new-processwire-site-profile/

Share this post


Link to post
Share on other sites
 
 
 
2
On 4/29/2019 at 6:09 PM, Robin S said:

Hi @Rhen GWL and welcome to the PW forums.

By any chance do you have the template setting "Should page URLs end with a slash?" set to "No"?

2019-04-30_110712.png.a9750fe8950143f5558e3cfefa92625d.png

 There seems to be an issue with the default action of the comments form that will submit the form to the parent page if the current page has no trailing slash.

I opened a GitHub issue here, and in the meantime until Ryan responds you can override the default form action in the $options array for renderForm():


echo $page->comments->renderForm(array('attrs' => array('action' => $page->url)));

 

My template is set to end with a slash.

But I implemented your override and that worked!! Thanks!

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By eschoonen
      I'm working on the threaded comments on my website and for this I need to include the comments.js
      When I do this it keeps on giving me the "Uncaught ReferenceRrror: jQuery is not defined". Whatever I do it keeps giving me this error message.
      It's the last javascript file that I load in. So how do I fix it?
    • By quickjeff
      Hi Guys,
      I am running a page template that contains a filter form that allows users to display results based on number of  comments. 
      Here is what I am thinking about doing: 
      -add new field called total_comments 
      -somehow populate this field every time a new comment is added or removed by admin with count($page->comments)
      -use form filter to display results that the selector form has found.
      Example: $selector = “total_comments>=$q”; 
       
      My question to everyone: Is this a good approach? If so how do I get another field to update based on the comment module adding or removing a comment? 
    • By quickjeff
      Hey Guys, 
      I am using the https://processwire.com/api/fieldtypes/comments/ to  allow users to comment and rate. Whats the best approach to get an average of all the star ratings for the page?
      Any direction is greatly appreciated!  
    • By gebeer
      Hello,
      I need to add a checkbox to the  comments form to make it GDPR compliant and I guess I'm not the only one...
      Doing a search and looking at the FieldTypeComments module file it seems that the only way to add custom fields to the form is by copying the module to  site/modules and apply the changes there.
      I am just wondering why the comment form is not driven by the PW form API and also why none of the methods in that module are hookable?
      Would be much appreciated if you could share your approaches on handling this.  
    • By albertax
      Hi, I am wondering if someone can help me out with getting the count of the comments of a page? 
      I am using Ryan's comments module as a reviews system for my site and would like to display the count of the comments per page, as below 
       

       
      The shops part that you see above is something similar to this 
      <?php $set_page = $page->title; $count = $pages->count("template=prices, title=$set_page"); echo $count; ?>  
×
×
  • Create New...