Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
Hello everyone, I'm Israel and I'm new here. I've been using Couch Cms for a week now and it's been awesome!

I have ported a html landing page to Couch successfully but I have a small problem.

My contact form does not reset or become empty after submission. How can I make it reset automatically after submission? Thank you
Hello and welcome, Israel.
I am glad you are finding Couch useful.

Replying to your query -
the best way to clear inputs after successful form submission is to 'refresh' the page by redirecting to itself.
You can do that by adding a <cms:redirect> statement in the k_success block of your form e.g. as follows -
Code: Select all
<cms:if k_success >
    .. existing code ..
   
    <cms:redirect k_page_link />
</cms:if>

It is good UX to show a success message also to the user.
This can be done using <cms:set_flash> and <cms:get_flash> e.g. as follows where we set the message in the success block before redirecting. When the page refreshes, the flash message is picked up and a success message is displayed just above the empty form -
Code: Select all
<cms:if "<cms:get_flash 'success_msg' />">
   <div id="desc">Thank you for contacting us. We'll get back to you soon.</div>
</cms:if>

<cms:form ..>
    <cms:if k_success >
        ..
       
        <cms:set_flash name='success_msg' value='1' />
        <cms:redirect k_page_link />
    </cms:if>

    ..

</cms:form>

Hope this helps.
Thank you so much! It worked. Your guide was easy to follow
3 posts Page 1 of 1
cron