ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Comment form not submitting data, not returning to proper return URL

February 10, 2013 6:13pm

Subscribe [3]
  • #1 / Feb 10, 2013 6:13pm

    benek

    189 posts

    I have a comment form that is not functioning properly.

    When I try to submit a comment, nothing gets saved to the database, and instead of retuning me to the specified return URL it returns me to the same single entry page with the comment form. No error is given and no other indication that anything is wrong.

    Other forms on the site like Freeform contact form works fine. Just the comment form is not working.

    The weblog and entry I’m testing on both have comments enabled.

    Here’s is my template code:

    {exp:comment:form channel="blog" preview="blog/comment" form_class="default" return="{homepage}blog/comment-thanks"}
         <fieldset>
          <ul class="formRow">
           {if logged_out}
           <li class="third">
            <label>Name <span class="req">*</span></label>
            <input type="text" name="name" value="{name}">
           </li>
           <li class="third">
            <label>Email <span class="req">*</span></label>
            <input type="text" name="email" value="{email}">
           </li>
           <li class="divider">.</li>
           {/if}
           <li class="wide">
            <label>Comment <span class="req">*</span></label>
            <textarea name="comment">{comment}</textarea>
           </li>
           {if captcha}
           <li class="divider">.</li>
           <li class="wide">
            <label>{captcha} <span class="req">*</span></label>
            <input type="text" name="captcha">
           </li>
           {/if}
           <li class="divider">.</li>
           <li class="buttons">
            <a href="#%22class=%22btn" class="btn submit arrow">Submit Comment</a>
           </li>
          </ul>
         </fieldset>
        {/exp:comment:form}

    I’ve read in other places that forcing trailing slashes on URLs or removing “www” from URLs can cause problems with form submissions. I am using .htaccess to remove index.php but I am not removing “www” nor am I forcing trailing slashes. And as said above other form submissions are working fine, just not comment form.

    With no error message it’s becoming very difficult for me to tell why else it wouldn’t work.

    Any ideas? How can I debug this?

  • #2 / Feb 11, 2013 11:12am

    Boyink!

    5011 posts

    Might be a parse order issue trying to use the {homepage} variable as a parameter.  I’d try just a standard template group/template name there.

    Have you tried stripping down some of the parameters?  I’ve used the comment_form tag on single-entry pages without any parameters at all successfully.

  • #3 / Feb 11, 2013 2:50pm

    benek

    189 posts

    Thanks Boyink! for the reply.

    I know it’s not the {homepage} variable causing the problem. This code was copied from another working site and it was fine there. I can also see in the rendered page source code that the return URL is as it should be.

    I’ll try removing parameters and see if that makes any difference, but I don’t suspect it will. Again, this code was re-used from a working site with nearly the same parameters so I know there’s no reason why they should be cocking it up.

    There must be something else at play here I can’t figure out what.

  • #4 / Feb 11, 2013 4:39pm

    benek

    189 posts

    I’ve tried simplifying the comment form so there are no parameters. Still no fix. When form is submitted page just reloads. No data saved to database. No POST or GET data. No correct return URL.

  • #5 / Feb 11, 2013 4:41pm

    Boyink!

    5011 posts

    What if you hard-code a channel and entry url title?

    Does the form appear at a normal single-entry URL?

  • #6 / Feb 11, 2013 4:46pm

    benek

    189 posts

    Just tried hard-coded channel and url_title. No effect.

    Form appears on a single-entry page.

  • #7 / Feb 13, 2013 6:50pm

    benek

    189 posts

    Any other ideas on this one? I’m still banging my head over here. Spent hours looking at this and can’t figure it out. Really need a second pair of eyes to spot something big I’m obviously missing.

  • #8 / Feb 13, 2013 7:30pm

    ahmad saad

    364 posts

    can you please post your .htaccess file

    and if you can give me a test page so I can see what happend there.

    Regards,

    Ahmad saad.

  • #9 / Feb 13, 2013 7:51pm

    benek

    189 posts

    Here’s a single entry page example of where I’m seeing the problem: http://www.findaband.co.nz/blog/post/choosing-a-wedding-band

    You can try to submit the comment form there.

    .htaccess attached. I’ve tried removing my .htaccess file entirely and it doesn’t solve the problem.

  • #10 / Feb 13, 2013 9:20pm

    ahmad saad

    364 posts

    I do some tests on the link you give me and the problem in your .htaccess.txt

    please try to use the simple way to remove the index.php

    <IfModule mod_rewrite.c>
            RewriteEngine On
    
            # Removes index.php from ExpressionEngine URLs
            RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^(.*)$ /index.php/$1 [L]
    </IfModule>
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases