Forum

Thread tagged as: Problem, Forms

Perch Form trouble perch_forms_v1.8.2

I'm having some trouble / odd behavior with a contact form I'm trying to build. I downloaded perch_forms_v1.8.2 I almost copied the template from a similar contact form I made about a month ago.

<div class="contact-form">
    <p class="icon-tab email-tab">
        <perch:content id="contactFormTitle" type="smarttext" label="Store Info Title" required="true" />
    </p>
    <div class="hr"></div>

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

        <!-- Perch Error messages -->
        <perch:error for="all" type="general">
            <p class="error-all">Sorry, something went wrong and the form was not sent. Please see the messages below.</p>
        </perch:error>
        <perch:error for="name" type="required"><p class="error-field">&centerdot; Enter Name</p></perch:error>
        <perch:error for="email" type="required"><p class="error-field">&centerdot; Enter Email</p></perch:error>
        <perch:error for="email" type="format"><p class="error-field">&centerdot; Enter Valid Email</p></perch:error>
        <perch:error for="subject" type="required"><p class="error-field">&centerdot; Enter Subject</p></perch:error>
        <perch:error for="message" type="required"><p class="error-field">&centerdot; Enter Message</p></perch:error>


        <!-- The Form -->
        <perch:input id="name" type="text" required="true" placeholder="First Name *" />
        <perch:input id="email" type="email" required="true" placeholder="Email *" />
        <perch:input id="phone" type="text" placeholder="Phone" />
        <perch:input id="subject" type="text" required="true" placeholder="Subject *" />
        <perch:input id="message" type="textarea" name="message" required="true" placeholder="Message *" />
        <perch:input class="button btn-solid" type="submit" id="submit" value="Send" />

        <!-- Perch Success Message -->
        <perch:success>
            <p class="italic form-success"><perch:content id="success" type="textarea" label="Form Success Message" required="true" /><p>
        </perch:success>
    </perch:form>
</div>

What is happening is that all the error/success messages are being renderd on page load. The actual form is not being rendered. However, all the messages and form fields show up in the Google Dev Tools, with <perch: ... /> tags!? I don't know that I've ever seen that before. Additionally all the perch tags for the form are nested inside each other??

I made sure I had updated my config/apps.php file, and it look fine. Any ideas??

Nicholas Nelson

Nicholas Nelson 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

How are you displaying the form? Which page function are you using?

I'm using perch_content('Contact Form'); I just checked to be sure this is the same as the one I made last.

As far as the output, it basically seems that perch isn't processing the template. This would make sense with the error messages being output.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you resaved the region since changing the content of the template?

Yep, even deleted it and reset it in the admin to double check.

Just in case, this is my config/apps.php file

<?php
    $apps_list = array(
        'content', 
        'categories',
        'perch_forms',
    );
Drew McLellan

Drew McLellan 2638 points
Perch Support

I just copied and pasted your template into my installation and it's working perfectly for me.

Can you confirm you're on Perch 2.7.2?

Huh, that's odd. I did have Perch 2.7.2 already, but I just downloaded the files again and replace core/ along with downloading the forms_app again.

Still the same result for me. I don't seem to have any PHP errors in my log regarding my contact page.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I'm not sure what to suggest, to be honest.

I looked into the rest of the code in that file and I see no unclose tags and such. The only thing a little fishy is that when I start up MAMP PRO I get an alert saying:

Such a file could interfere with MySQL in MAMP. In case of problems remove /etc/my.cnf, /etc/mysql/my.cnf or ~/.my.cnf.

I don't suppose that could have anything to do with it? I just trying searching for what this^ means without much success.

I just updated perch/core and perch_forms in the site I made a month ago. Both were one version out of date. The form on this site still seems to work.

I am baffled by the new one... I had coded a regular HTML version for styling before adding Perch which rendered as expected.

Alright, I got it working. It was a really stupid problem. Somewhere along the line I screwed up the <perch:form> tag.

Thanks for your time!