Problem with comments module and browser catche

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
vorcan
Forum Members
Forum Members
Posts: 12
Joined: Thu May 19, 2011 7:08 am

Problem with comments module and browser catche

Post by vorcan »

Hello there,

I'm facing a problem with Comments module. Everything works fine, except one thing - errors display. When I fill the comment form correctly, a comment is added/displayed. When some requied field is not filled or filled in wrong way, the errors are displayed. Till then, everything is as it should be. Problem starts to appear, when I firstly fill the form with errors and then I try to fill it again, correcting requied fields. When I do so, and press "send" again, comment is added. However, the display of errors still remains.

Normally, when the form is firstly filled with some wrong entries, there should be a message informing what's wrong and when the form is filled again, thisa time correctly, this message should disappear. Here, it doesn't. Comment is added succesfully, but there is still message, informing about errors. Moreover, this message is displayed at every place, where there is a comment form. So, even if I go to another page (e.g. another news) and I want to comment it, I can see error message there. So it's like...if there are some errors during form filling, the error message is added permamently to the site. I can write another comment and it will be added, I can go to another page with comments form and I still see errors, I can refresh the page, open it in another tab/window, or even close the browser completely and when I open it few mins later, the errors are still displayed.

Described situation happens in every browser (tried ff 7, chrome 13, safari, opera 10 and ie 8). I spent some time, trying to find some solution, and I discovered that it's connected to browser catche somehow. When I clear browser catche, error message disappear completely. Problem is that I doubt any of site's visitors will figure out what should they do in order to get the rid of this message. They will be surely confused, because they filled everything correctly, and they still see error. Probably some will not even notice that the comment itself was added and they are going to think that the whole system doesn't work. Thus, I really would like to find solution for that and I hope someone can help me out.

I modified the original comment template a bit, but I tested also an original one and the problem is there as well.

Will be grateful for any kind of idea how to solve this.
lewis
Forum Members
Forum Members
Posts: 14
Joined: Mon Jun 30, 2008 11:20 pm

Re: Problem with comments module and browser catche

Post by lewis »

Hi,
I have the same problem. The thing is down to this fragment of code:

Code: Select all

{if isset($smarty.session.Comments.error)}
  {* display an error message from the comments module *}
  <div style="text-size: 1.5em; color: red;">{$smarty.session.Comments.error}</div>
{elseif isset($smarty.session.Comments.message)}
  {* display an optional message from the comments module *}
  <p style="text-size: 1.5em; color: green;">{$smarty.session.Comments.message}</p>
{/if}
The issue is that $smarty.session.Comments.error and $smarty.session.Comments.message are not cleared after comment is inserted to database or user leave page. They are set once and then stays until user clears their cache. The 'success' message is recorded and stays on every comments form until some error on any comments for will not override it.

Please share the solution if you found one.
Post Reply

Return to “Modules/Add-Ons”