0

I finally managed to get Favorites to show on my page.

I've been testing the adding favorites function on a test page, but I keep on getting the "This form has expired. Please refresh and try again."

Here's how I currently have the Favorites set up:

                <!-- ADD a Favorite -->
            {if favorites:no_results}

                    {exp:favorites:form
                            {segment_3}_id="{segment_4}"
                            return="{path='favorites_inc/favorites_info_ajax/{segment_3}/{segment_4}'}"
                            error_page="{path='favorites_inc/error_ajax'}"
                        }
                         <p>Favorite this to
                            <select name="collection" class="form-control input-sm">
                                {favorites:collections}
                                    <option value="{favorites:collection}">
                                {favorites:collection}
                                    </option>
                                {/favorites:collections}
                            </select>
                                <button type="submit" class="fa fa-heart fa-lg" style="margin-top:-0.25em;"> <span style="color:#444;">add</span></button>
                    {/exp:favorites:form}
                        </p>
            {/if}

                {/exp:favorites:info}
            </div>
            {/if}

Currently using: EE ver 2.8.1. Favorites ver 4.0.4

Any help on this would be much appreciated.

3
  • Please strip your code example down to only the part you're having trouble with so it's easier for folks to read and understand. Also, please include the version of both the Favorites module and ExpressionEngine which you're currently running. Dec 12 '15 at 18:34
  • Are you caching your template in any way? That error is typical in EE for forms submitted with a cached csrf_token value. Make sure the hidden csrf_token field in the form is not cached and is refreshed when opening a new session (eg. when using another browser or computer).
    – Solspace
    Dec 15 '15 at 14:07
  • It's also a good idea to compare your code with the Demo Templates that come with Favorites. Sometimes it can reveal what might be different and going wrong.
    – Solspace
    Dec 15 '15 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.