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 redirect

December 02, 2008 2:19pm

Subscribe [2]
  • #1 / Dec 02, 2008 2:19pm

    Jacob Fentress

    37 posts

    Is there any way to dictate where a comment form takes the user after submitting the comment?

    I want to put a stand-alone comment form on one page, but have it send the user to another page after commenting. The comment page url path setting in weblog preferences doesn’t seem to help with this.

    No matter what I tried, it just takes me back to the same page where the form is.

    Thanks for the help.

  • #2 / Dec 02, 2008 2:41pm

    Pascal Kriete

    2589 posts

    Hey Jacob,

    There is no native way of doing this right now.  You might be able to hook into the comment module.  This would probably make a good feature request as well.

  • #3 / Dec 02, 2008 3:22pm

    Jacob Fentress

    37 posts

    Thanks Pascal,

    I just got it to do what I wanted by using the form code generated by the comment form tag, and changing the RET hidden value to the page I want them to end up on. So, I’m not using the ExpressionEngine comment form tags anymore, but am just using the html form code.

    Does this sound like a viable alternative, or are there problems that come to mind with this approach?

    Thanks again.

  • #4 / Dec 02, 2008 4:13pm

    Pascal Kriete

    2589 posts

    It will break when you’re using secure forms so I can’t recommend it.  It should work fine otherwise so it may be a plausible solution for the interim.  Definitely put in a feature request though and remember that this form won’t adhere to changes made in the cp (like paths).

  • #5 / Dec 02, 2008 6:14pm

    Jacob Fentress

    37 posts

    Some good points, and I don’t mean to argue, but I continued playing as an exercise for myself and anyone else that may run into this.

    It actually is possible to have this work with secure forms if we treat this as a standalone form and use the advice on this wiki page.

    So, a stand alone comment form with a custom landing page might look something like:

    <form id='comment_form' method="post" action="http://www.example.com"  >
    <div class='hiddenFields'>
    <input type="hidden" name="ACT" value="1" />
    <input type="hidden" name="RET" value="http://www.example.com/landing-page/" />
    <input type="hidden" name="URI" value="/test/" />
    <input type="hidden" name="PRV" value="weblog/preview" />
    <input type="hidden" name="XID" value="{XID_HASH}" />
    <input type="hidden" name="entry_id" value="1263" />
    <input type="hidden" name="site_id" value="1" />
    </div>
    
    Name: <input type="text" name="name" value="" size="50" /></p>
    
    Email: <input type="text" name="email" value="" size="50" /></p>
    
    Location: <input type="text" name="location" value="" size="50" /></p>
    
    URL: <input type="text" name="url" value="http://" size="50" /></p>
    
    
    <textarea name="comment" cols="70" rows="10"></textarea>
    
    <input type="checkbox" name="save_info" value="yes"  /> Remember my personal information
    
    <input type="checkbox" name="notify_me" value="yes"  /> Notify me of follow-up comments?
    
    
    <input type="submit" name="submit" value="Submit" />
    <input type="submit" name="preview" value="Preview" />
    
    </form>

    Change out the RET value and the XID value from the generated code and things should work as expected. Also, that wiki page has some tips on using the captcha.

    Again, as Pascal pointed out, this is not ideal because it is almost sure to break in certain situations, and you always run into problems with hacks like this when it comes time to upgrade your system.

    Thanks again for the insights, Pascal.

  • #6 / Dec 02, 2008 6:21pm

    Ingmar

    29245 posts

    Well, glad you found a working solution for you. Please don’t hesitate to post again as needed.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases