Forum

Thread tagged as: Problem

'success' message not displayed after form submit

I work in a MAMP setup. I've installed the Forms app and have used a template for the form based on your example in docs (there are more fields in my form but it's simplified below for brevity). The form displays and works correctly:

<perch:form id="contact" method="post" app="perch_forms">

    <perch:content id="intro" type="textarea" label="Intro" textile="true" editor="markitup" size="m" help="Insert here your own first lines of email message (if any)" />

    <div class="form-field">
        <perch:label for="name">Name</perch:label>
        <perch:input type="text" id="name" required="true" label="Name" placeholder="your full name" />
        <perch:error for="name" type="required">Please add your name</perch:error>
    </div>

    <div class="form-field">
        <perch:label for="email">Email</perch:label>
        <perch:input type="email" id="email" required="true" label="Email" placeholder="you@domain.com" />
        <perch:error for="email" type="required">Please add your email address</perch:error>
        <perch:error for="email" type="format">Please check your email address</perch:error>
    </div>

    <div class="form-field">
        <perch:label for="message">Message</perch:label>
        <p><perch:input type="textarea" id="message" required="true" label="Message" /></p>
        <perch:error for="message" type="required">Please enter a message</perch:error>
    </div>

    <div class="form-field">
        <perch:input type="submit" id="submit" value="Send" />
    </div>

    <p class="font-80percent">You will automatically be emailed a copy of the details that you’ve entered on this form</p>

    <perch:success>
        <perch:content id="success" type="textarea" label="Thank you message" textile="true" editor="markitup" show-form="true" size="s" />
    </perch:success>

</perch:form>

In the web page I've inserted this region:

<?php perch_form('test-form-template-1.html'); ?>

I'm able to configure the functions in the admin area and the email send and autoresponse are working fine. All is good except that after Submit the form disappears but no Success message is displayed. As you can see I've also tried show-form="true" but the form is still not displayed after Submit.

Also, I don't find in Perch admin for the page (or anywhere in Admin) fields to edit perch:content id="intro" and perch:content id="success". In admin for the page, only perch fields outside of the form are offered, and in Admin for the form ('Editing form options') I can only edit the processing not the content.

I'm missing something fundamental about how this setup works but can't fathom where.

Peter Hammarling

Peter Hammarling 0 points

  • 4 years ago

Update: I put a 'Success' message into the html template that the page uses, and that displays after 'Submit'. But it would be better if the editors could add their own via the Perch admin. Same goes for the intro line of text of the email.

Simon Clay

Simon Clay 127 points

Hi Peter,

You can have your cake and eat it :)

You've used <?php perch_form('test-form-template-1.html'); ?> to call the form which is fine but if you want the editor to be able to add their own intro and success message, you should use Perch Content instead:

<?php perch_content('Contact Form'); ?>

Place your test-form-template-1.html into the perch/templates/content folder and choose it as the template for the region.

Tip: if you make any changes to your form template, don't for get to save the region in Perch Admin each time to see the changes.

Thanks Simon. I did it that way because I thought that it had to be like that in order to get the email and autoresponse functionality. Is that not the case? Will it all work the same if I use perch_content?

Simon Clay

Simon Clay 127 points

Hi, yes it will.