Forum

Thread tagged as: Question, Problem, Error

Trouble with Forms

Trying loads of new stuff with this latest build and I'm trying to get the forms app to work.

I think I've installed correctly, added the app to the apps.php and I get the menu item displaying

and I've set up a form in my page (template has gone into content which Rachel did on her vid tutorial rather than the forms template folder)

heres my form code

<li class="callback">
<h2 class="blue">request a callback</h2>
    <perch:form id="callback" method="post" app="perch_forms" role="form">
    <div>
        <perch:input type="text" id="name" required="true" label="Your Name" class="name" placeholder="Your name"/>
        <perch:input type="text" id="phone" required="true" label="Phone Number" class="phone" placeholder="Tel No."/>
    </div>
    <div>
             <perch:input type="text" id="email" required="true" label="Email Address" class="email" placeholder="Email Address"/>
    </div>
    <perch:input type="submit" id="submit" class="blue" value="submit"/>

<perch:success>
       <perch:content id="thankyou" label="Success message" type="textarea" textile="true" editor="markitup" />
</perch:success>

</perch:form>                   
</li>       

and here's how I'm calling it in the page

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

it's all displaying correctly... however when I submit the form I'm not seeing my success message and the Form app in admin is empty and still says I need to submit a form for it to show up here.

What have I done wrong?

Nik Gill

Nik Gill 1 points

  • 7 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Are you completing all the fields when you fill it out as you have required fields with no error messages so an incorrectly completed form will just resubmit and not show the success message.

Hi Rachel... yeah, I'm completing all the fields... when I click submit it just reloads the page

Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you have any redirects or URL rewriting in place that might affect it?

Hi Drew... all i have in my .htaccess at the moment is a redirect for the index.html to the index.php

Redirect /index.html https://dev.mysite.net/index.php

Drew McLellan

Drew McLellan 2638 points
Perch Support

Is your form submitting to index.html ? The redirect would throw away the post data.

It shouldn't do, theres nothing in my form markup or page markup to do that...

The form should just submit to Perch Forms as per below?

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

Ah... I've just taken that line out of the htaccess file and the form is now working.

Any idea why this blocked the form? I would have thought this was the simplest of redirects wouldn't have had any effect?

Rachel Andrew

Rachel Andrew 394 points
Perch Support

A redirect isn't going to pass along the form data. That's just not how things work.

Ah right ok... it was just a simple redirect so that when the site is accessed it's forced to load the index.php file... otherwise the selected states on my menu go all cock eyed if the page is / rather than /index.php

I'll see if I can find another way of sorting that out.

I've sorted it now and made a change to my php so my menu works ok without the redirect

Thank you both for your help once again