Forum

Thread tagged as: Question, Forms

Perch Forms - not able to choose "Email Address Field"

In the Forms app, all is working well. In Form settings, under the "Email Address Field" there's a select box with no options. What should go there? There is an email field in the form, which is called "Email" and of type "Email", so I wondered why it was blank? All seems to be working well, but I just wondered what that field is for, and why I can't select anything.

Here's my diagnostic report:

Perch: 2.8.24, PHP: 5.5.31, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 15d5c781cfcad91193dceae1d2cdd127674ddb3e $, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (2.8.24), assets (2.8.24), categories (2.8.24), perch_events (1.9.2), perch_forms (1.8.3)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_events', 'perch_forms', );
PERCH_LOGINPATH: /perch
PERCH_PATH: /home4/mydomain/public_html/perch
PERCH_CORE: /home4/mydomain/public_html/perch/core
PERCH_RESFILEPATH: /home4/mydomain/public_html/perch/resources
Image manipulation: GD Imagick
PHP limits: Max upload 128M, Max POST 128M, Memory: 128M, Total max file upload: 128M
F1: dc1fef2ad0fcd9f943c02ebb43d85dbc
Resource folder writeable: Yes
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
REQUEST_URI: /perch/core/settings/diagnostics/
DOCUMENT_ROOT: /home4/mydomain/public_html
HTTP_HOST: mydomain.co.uk
Paul Bell

Paul Bell 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you post your template? The fields come from it.

Sure

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

    <perch:content id="intro" type="textarea" label="Intro" textile="true" editor="markitup" size="m" />

    <perch:error for="all" type="general"><p><span class="error">
        Sorry, something went wrong and the form was not sent. Please see the messages below.
    </span></p></perch:error>

    <div>
        <perch:label for="name">Name</perch:label>
        <perch:input type="text" id="name" required="true" label="Name" />
        <perch:error for="name" type="required"><span class="error">Please add your name</span></perch:error>
    </div>

    <div>
        <perch:label for="telephone">Telephone</perch:label>
        <perch:input type="text" id="telephone" required="true" label="Telephone" />
        <perch:error for="telephone" type="required"><span class="error">Please add a phone number</span></perch:error>
    </div>

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

    <div>
        <perch:label for="arrival">Desired arrival date</perch:label>
        <perch:input type="text" id="arrival" required="true" label="Arrival date" value="<perch:content id="date" />"/>
        <perch:error for="arrival" type="required"><span class="error">Please enter a desired arrival date</span></perch:error>
    </div>

    <div>
        <perch:label for="number_of_nights">Number of nights</perch:label>
        <perch:input type="select" options="1,2,3,4,5,6,7,8,9,10,11,12,13,14" id="number_of_nights" required="true" label="Number of nights" />
        <perch:error for="number_of_nights" type="required"><span class="error">Please enter the number of nights you wish to book</span></perch:error>
    </div>

    <div>
        <perch:label for="booking_type">Desired booking type</perch:label>
        <perch:input type="select" id="booking_type" options="Double|double,Twin|twin,Cottage|cottage" required="true" label="Booking type" value="<perch:content id="type" />"/>
        <perch:error for="booking_type" type="required"><span class="error">Please indicate the type of booking you wish to make</span></perch:error>
    </div>

    <div class="contact-field">
        <perch:label for="contact">Leave the next field blank</perch:label>
        <perch:input type="text" id="contact" antispam="honeypot" />
    </div>

    <div>
        <perch:label for="message">Message</perch:label>
        <perch:input type="textarea" id="message" required="false" label="Message" />
        <perch:error for="message" type="required"><span class="error">Please add a message</span></perch:error>
    </div>

    <div>
        <perch:input type="submit" id="submit" value="Send" />
    </div>

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

This is in templates/content. Is that right?

Drew McLellan

Drew McLellan 2638 points
Perch Support

That looks fine - is the form otherwise picking up the template ok?

If you turn debug on, what does it output at the bottom of that form options page?

Here's what's showing there:

Debug Message
SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='349ee31ebc0de700f8b6f930c9a0031a' LIMIT 1
UPDATE perch2_users SET userHash='0b20b4447c1d2a000461a65c5e6e341e' WHERE userID='1'
SELECT p.privKey FROM perch2_user_privileges p
SELECT * FROM (SELECT DISTINCT settingID, settingValue, userID FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID, settingValue, userID
SELECT * FROM perch2_forms WHERE formID=1 LIMIT 1
Queries: 6
Memory: 2.2759

There have been 100+ form submissions.

Drew McLellan

Drew McLellan 2638 points
Perch Support

What's the full path of your template?

/wwwroot/perch/templates/content/booking_form.html

Drew McLellan

Drew McLellan 2638 points
Perch Support

That could be the issue. Your site is at

/home4/mydomain/public_html/perch

and your template is under

/wwwroot/perch

Sorry, Drew - I gave you a path from our old hosting. Correct path:

/home4/mydomain/public_html/perch/templates/content/booking_form.html

Hi Drew - I've managed to solve this. The problem was that the site had been on Windows hosting, and was moved to Linux hosting. The stored path to the template in the database had backslashes, not forward slashes, so the template file was not being found. Having edited this value in the database, the drop down list is populated and I'm able to select the "email" input field. So quite a niche issue.

(I edited the form.settings.post.php file to output the path to the file it was looking in and that was what lead me to the field in the database, along with your helpful comments). Thanks.

As Perch CMS grows in popularity migrations between server enviorments will possibly increase. I hope Perch CMS will automatically update to server changes infuture. Thanks for fixing Paul and your help Drew.

David - while there may be server migrations, migrations between Windows and Linux are probably quite rare, so I doubt this will be a priority in terms of finite development resources - good that we managed to resolve the issue however. :)

Drew McLellan

Drew McLellan 2638 points
Perch Support

It's actually just a Forms bug - we should be translating the path. Perch generally accounts for the different styles of file system paths.