3

Suppose I have a Safecracker form that will edit channel entries. Once the entry is edited I want to display something like "Thanks for editing your entry" on the edit entry page. How would I go about displaying a thank you message on successful form submission? I do not want to be redirected to another page.

Here is example code.

{exp:safecracker channel="channel_name" return="channel_name/edit/ENTRY_ID" entry_id="{segment_3}"}

Title:<input name="title" type="text" value="{title}">
<br/><input type="submit" value="Submit">

{/exp:safecracker}

1 Answer 1

1

It sounds like you are looking for an AJAX-style contact form where you display the success or failure message on the same page without a refresh. I might suggest this article: Creating a modern AJAX contact form in ExpressionEngine. It also mentions the difference between adding AJAX to EE's native contact form and adding AJAX to other form add-ons like Solspace's Freeform.

Alternatively, you can reload the same page/template but add another URL segment, like:

return="channel_name/edit/ENTRY_ID/success"

Then you can display a success message on that same template when the segment matches:

{if segment_4 == "success"}
    <p>Success message here</p>
{/if}

This does not offer inline validation, like AJAX will, but it is a simple option.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.