Forum

Thread tagged as: Question

Few issues re: Forms

I've been able to create a Form using Perch Forms, and am embarking on a HTML email template, however now that I have created a /forms/email folder I am wondering why any .html templates do not appear in the /forms folder (logical).

So while templates in /content are in alphabetical order, folders are not so why is this the case?

Regarding my issues, it seems that the custom error messages I have made are not being shown in the browser.

In addition a supposed required field (enquiry) is being allowed through.

Here is my template:

<perch:form id="form-contact" method="post" action="/contacts/index.php" app="perch_forms" role="form"> 

<table id="ContactTable">
<caption>Contact Form</caption>
<thead>
<tr>
<td>Please enter your contact details and message.</td>
</tr>
</thead>
<tbody>
<tr>
<td>
<perch:label for="name">Name</perch:label>
<perch:input id="name" type="text" required="true" label="Name" />
<perch:error for="name" type="required">Please type your name</perch:error>
</td>
</tr>
<tr>
<td>
<perch:label for="email">Email</perch:label>
<perch:input id="email" type="email" required="true" label="Email" placeholder="you@company.com" />
<perch:error for="email" type="required">Please add your email address</perch:error>
</td>
</tr>
<tr>
<td>
<perch:label for="enquiry">Enquiry</perch:label>
<perch:input id="enquiry" type="select" label="Enquiry" options="Select Enquiry Type..., General Enquiry, Request Information, Other" />
<perch:error for="enquiry" type="required">Specify enquiry type</perch:error>
</td>
</tr>
<tr>
<td>
<perch:label for="message">Message</perch:label>
<perch:input id="message" type="textarea" required="true" label="Message" />
<perch:error for="message" type="required">Please include a message</perch:error>
</td>
</tr>
<tr>
<td><perch:input type="submit" id="submit" value="Send" class="submit"/></td>
</tr>
</tbody>
</table>

<perch:success>
<p>Thank you</p>
</perch:success>

</perch:form>

Thanks for any help or assistance.

Garth Holmes

Garth Holmes 1 points

  • 6 years ago

In addition, I cannot specify a template for HTML email even after a form has been submitted:

<html>
<head>
    <title><perch:email id="email_subject" /></title>
</head>
<body>
    <h1>Form Submission</h1>
    <p><perch:email id="email_message" encode="false" /></p>
    <table>
        <tr>
            <th>Name</th>
            <td><perch:email id="name" /></td>
        </tr>
        <tr>
            <th>Email</th>
            <td><perch:email id="email" /></td>
        </tr>
        <tr>
            <th>Enquiry</th>
            <td><perch:email id="enquiry" /></td>
        </tr>
        <tr>
            <th>Message</th>
            <td><perch:email id="message" encode="false" /></td>
        </tr>
    </table>
</body>
</html>
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you show us your diagnostics report?

The required field looks fine - it has four options and there's no way for a user to not have one of those options selected.

Yes but if you leave the first option selected, it counts as not being required.

Is there any way to specify a default option without it being used as per a form submission?

    Perch: 2.8.6
    Production mode: Production (100)
    Installed apps: content (2.8.6), assets (2.8.6), categories (2.8.6), perch_forms (1.8.3), perch_backup (1.2)
    DB driver: PDO
    DB tables: perch2_categories, perch2_category_counts, perch2_category_sets, perch2_content_index, perch2_content_items, perch2_content_regions, perch2_forms, perch2_forms_responses, perch2_navigation, perch2_navigation_pages, perch2_page_templates, perch2_pages, perch2_resource_log, perch2_resource_tags, perch2_resources, perch2_resources_to_tags, perch2_scheduled_tasks, perch2_settings, perch2_user_privileges, perch2_user_role_privileges, perch2_user_roles, perch2_users
    Users: 3
    App runtimes:

    <?php
        include(PERCH_PATH.'/core/apps/content/runtime.php');
        include(PERCH_PATH.'/addons/apps/perch_forms/runtime.php');
    ?>

    Editor plug-ins: markitup
    H1: 105ac2522953975ae65ce63d3a19775a
    L1: 6a10ba8fd6cf183b9e51e15979d54d45
    headerColour: #ffffff
    content_singlePageEdit: 1
    helpURL:
    siteURL: /
    hideBranding: 0
    content_collapseList: 1
    lang: en-gb
    update_2.1.4: done
    latest_version: 2.8
    update_2.3.3: done
    on_sale_version: 2.8.6
    update_2.3.4: done
    update_2.4: done
    update_2.4.1: done
    update_2.4.2: done
    update_2.4.3: done
    update_2.4.4: done
    update_2.4.5: done
    update_2.4.6: done
    update_2.4.7: done
    update_2.4.9: done
    update_2.5: done
    update_2.5.2: done
    update_2.5.3: done
    update_2.5.4: done
    update_2.6: done
    update_2.6.3: done
    update_2.6.6: done
    update_2.7: done
    update_2.7.2: done
    update_2.7.3: done
    update_2.7.4: done
    update_2.7.5: done
    update_2.7.6: done
    update_2.7.7: done
    update_2.7.8: done
    update_2.7.9: done
    update_2.7.10: done
    update_2.8.2: done
    update_2.8.4: done
    update_2.8.5: done
    update_2.8.6: done
    PERCH_DEVELOPMENT: 10
    PERCH_STAGING: 50
    PERCH_PRODUCTION: 100
    PERCH_DB_USERNAME: sitemast_myperch
    PERCH_DB_SERVER: localhost
    PERCH_DB_DATABASE:
    PERCH_DB_PREFIX: perch2_
    PERCH_TZ: UTC
    PERCH_EMAIL_FROM:
    PERCH_EMAIL_FROM_NAME:
    PERCH_LOGINPATH: /perch
    PERCH_PATH: /home/sitemaster/public_html/perch
    PERCH_CORE: /home/sitemaster/public_html/perch/core
    PERCH_RESFILEPATH: /home/sitemaster/public_html/perch/resources
    PERCH_RESPATH: /perch/resources
    PERCH_HTML5: 1
    PERCH_DEBUG: 1
    PERCH_RUNWAY:
    PERCH_ERROR_MODE: DIE
    PERCH_DATE_LONG: %d %B %Y
    PERCH_DATE_SHORT: %d %b %Y
    PERCH_TIME_SHORT: %H:%M
    PERCH_TIME_LONG: %H:%M:%S
    PERCH_PREVIEW_ARG: preview
    PERCH_TEMPLATE_PATH: /home/sitemaster/public_html/perch/templates
    PERCH_DEFAULT_DOC: index.php
    PERCH_DEFAULT_EXT: .php
    PERCH_PRODUCTION_MODE: 100
    PERCH_RWD:
    PERCH_HTML_ENTITIES:
    PERCH_SSL:
    PERCH_STRIPSLASHES:
    PERCH_PROGRESSIVE_FLUSH: 1
    PERCH_AUTH_PLUGIN:
    PERCH_DB_CHARSET: utf8
    PERCH_DB_PORT:
    PERCH_DB_SOCKET:

Hosting settings

    PHP: 5.4.39
    Zend: 2.4.0
    OS: Linux
    SAPI: cgi-fcgi
    Safe mode: not detected
    MySQL client: mysqlnd 5.0.10 - 20111026 - $Id: c85105d7c6f7d70d609bb4c000257868a40840ab $
    MySQL server: 5.5.42-cll
    Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bcmath, calendar, ctype, curl, dom, filter, ftp, gd, hash, iconv, SPL, json, mbstring, mcrypt, session, mysql, mysqli, standard, Phar, posix, Reflection, mysqlnd, SimpleXML, sockets, imap, tokenizer, xml, xmlreader, xmlwriter, cgi-fcgi, PDO, pdo_sqlite, pdo_mysql
    GD: Yes
    ImageMagick: No
    PHP max upload size: 32M
    PHP max form post size: 64M
    PHP memory limit: 128M
    Total max uploadable file size: 32M
    Resource folder writeable: Yes
    Session timeout: 24 minutes
    Native JSON: Yes
    Filter functions: Yes
    Transliteration functions: No
    DOCUMENT_ROOT: /home/sitemaster/public_html
    GATEWAY_INTERFACE: CGI/1.1
    HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,text/vnd.wap.wml;q=0.6
    HTTP_ACCEPT_ENCODING: gzip, deflate
    HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.5
    HTTP_CONNECTION: keep-alive
    HTTP_COOKIE: PHPSESSID=49c222bda6980c9df900b1918dff7055; cmsa=1
    HTTP_HOST:
    HTTP_REFERER:
    HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0 SeaMonkey/2.33.1
    PATH: /bin:/usr/bin
    QUERY_STRING: extended
    REDIRECT_STATUS: 200
    REMOTE_ADDR: 59.167.232.140
    REMOTE_PORT: 58967
    REQUEST_METHOD: GET
    REQUEST_URI: /perch/core/settings/diagnostics/?extended
    SCRIPT_FILENAME: /home/sitemaster/public_html/perch/core/settings/diagnostics/index.php
    SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
    SERVER_ADDR: 27.124.121.210
    SERVER_ADMIN:
    SERVER_NAME:
    SERVER_PORT: 80
    SERVER_PROTOCOL: HTTP/1.1
    SERVER_SIGNATURE: <address>Apache/2.2.29 (Unix) mod_ssl/2.2.29 OpenSSL/1.0.1e-fips mod_bwlimited/1.4 Server at ramsdentraining.edu.au Port 80</address>
    SERVER_SOFTWARE: Apache/2.2.29 (Unix) mod_ssl/2.2.29 OpenSSL/1.0.1e-fips mod_bwlimited/1.4
    UNIQUE_ID: VUam-Rt8edIAABdPfm8AAAAH
    PHP_SELF: /perch/core/settings/diagnostics/index.php
    REQUEST_TIME_FLOAT: 1430693629.55
    REQUEST_TIME: 1430693629
    argc: 1

A few lines relating to the host were removed.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You should be able to use the placeholder attribute for your default value.

Hi Drew,

I put a required="true" attribute on the Perch input:

<perch:input id="enquiry" type="select" label="Enquiry" required="true" options=", General Enquiry, Request Information, Other" />

and simply put a , as the first value.

It works but does not allow you to specify placeholder text.

Thanks again for pointing that out.

It doesn't work because the form does not validate with w3c.

Drew McLellan

Drew McLellan 2638 points
Perch Support

How does it fail?