Forum

Thread tagged as: Problem, Forms

Form is not submitting

Hi there,

I have a form for users to submit there CV's. But for some reason the form is not submitting. Its bringing up no error. Here is my code:

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

    <h4>Complete your details</h4>

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

    <div>
        <perch:label for="tel">Telephone Number</perch:label>
        <perch:input type="text" id="tel" required="true" label="Telephone" />
        <perch:error for="tel" type="required">Please add your Telephone Number</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">Please add your email address</perch:error>
        <perch:error for="email" type="format">Please check your email address</perch:error>
    </div>

    <div>
        <perch:label for="subject">Subject</perch:label>
        <perch:input type="text" id="subject" required="true" label="Subject" />
        <perch:error for="subject" type="required">Please add your subject</perch:error>
    </div>

    <div>
        <label for="cv">Please upload your CV - * Note no larger than 6MB</label>
        <perch:input type="file" id="cv" accept="pdf doc" bucket="job_applications" label="CV" />

        <perch:error for="cv" type="fileupload">
          <span class="error">Couldn't upload the file - could be too big.</span>
        </perch:error>
    </div>

    <div>
        <perch:label for="message">Message</perch:label>
        <perch:input type="textarea" id="message" required="true" label="Cover Letter" />
        <perch:error for="message" type="required">Please add a cover letter</perch:error>
    </div>

    <div class="view-more" style="margin: 10px 0 auto;">
        <perch:input type="submit" id="submit" value="Send Application" class="submit-button" />
    </div>

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

</perch:form>

Here is my region

<?php perch_content('Job Applications'); ?>

I have the file uploads sitting outside of the public_html folder. Here is my diagnostics report

Perch: 2.6.6
Production mode: Production (100)
Installed apps: content (2.6.6), assets (2.6.6), categories (2.6.6), perch_blog (4.5.2), perch_forms (1.7), perch_gallery (2.8.5)
DB driver: MySQLi
DB tables: perch2_blog_authors, perch2_blog_categories, perch2_blog_comments, perch2_blog_index, perch2_blog_posts, perch2_blog_posts_to_categories, perch2_blog_posts_to_tags, perch2_blog_sections, perch2_blog_tags, perch2_categories, perch2_category_counts, perch2_category_sets, perch2_content_index, perch2_content_items, perch2_content_regions, perch2_forms, perch2_forms_responses, perch2_gallery_albums, perch2_gallery_image_versions, perch2_gallery_images, perch2_navigation, perch2_navigation_pages, perch2_page_templates, perch2_pages, perch2_resource_log, perch2_resource_tags, perch2_resources, perch2_resources_to_tags, perch2_settings, perch2_user_privileges, perch2_user_role_privileges, perch2_user_roles, perch2_users
Users: 9
App runtimes:
<?php
    include(PERCH_PATH.'/core/apps/content/runtime.php');
    include(PERCH_PATH.'/addons/apps/perch_forms/runtime.php');
    include(PERCH_PATH.'/addons/apps/perch_gallery/runtime.php');
    include(PERCH_PATH.'/addons/apps/perch_blog/runtime.php');
?>
Scheduled tasks for perch_blog: delete_spam_comments (1440 mins)
Editor plug-ins: markitup, ckeditor
H1: 85c4b6a3f55e3d7d8e53cffd34511d8a
L1: dec68a9f91f8730fd765cedccaf27466
headerColour: #ffffff
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 1
content_collapseList: 1
lang: en-gb
update_2.4.8: done
latest_version: 2.5.3
on_sale_version: 2.6.6
headerScheme: light
dashboard: 0
hide_pwd_reset: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
logoPath: /admin/resources/new-fc-logo-2014.png
update_2.4.9: done
perch_gallery_update: 2.8.5
perch_gallery_bucket_mode: dynamic
perch_gallery_bucket: gallery
perch_gallery_basicUpload: 0
perch_blog_post_url: /blog/post.php?s={postSlug}
perch_blog_update: 5.0
update_2.6.6: done
perch_blog_slug_format: %Y-%m-%d-{postTitle}
perch_blog_akismet_key:
perch_blog_max_spam_days: 1
perch_blog_comment_notify: 0
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_USERNAME: ouykunoh_newsite
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: ouykunoh_newsite
PERCH_DB_PREFIX: perch2_
PERCH_TZ: UTC
PERCH_EMAIL_FROM: chris@fishtankcreative.co.uk
PERCH_EMAIL_FROM_NAME: Damien Fisher
PERCH_LOGINPATH: /admin
PERCH_PATH: /home/ouykunoh/public_html/admin
PERCH_CORE: /home/ouykunoh/public_html/admin/core
PERCH_RESFILEPATH: /home/ouykunoh/public_html/admin/resources
PERCH_RESPATH: /admin/resources
PERCH_HTML5: 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_DEBUG:
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /home/ouykunoh/public_html/admin/templates
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_RWD:
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET:
PERCH_DB_PORT:
PERCH_DB_SOCKET:
HOSTING SETTINGS

PHP: 5.4.32
Zend: 2.4.0
OS: Linux
SAPI: cgi-fcgi
Safe mode: not detected
MySQL client: 5.5.37
MySQL server: 5.5.37-cll
Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dom, filter, ftp, gd, gettext, hash, iconv, SPL, json, mbstring, mcrypt, session, mysql, mysqli, standard, Phar, posix, pspell, Reflection, mysqlnd, SimpleXML, snmp, soap, sockets, imap, tidy, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, cgi-fcgi
GD: Yes
ImageMagick: No
PHP max upload size: 32M
PHP max form post size: 32M
PHP memory limit: 64M
Total max uploadable file size: 32M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: No
CONTEXT_DOCUMENT_ROOT: /home/ouykunoh/public_html
DOCUMENT_ROOT: /home/ouykunoh/public_html
GATEWAY_INTERFACE: CGI/1.1
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_ACCEPT_ENCODING: gzip,deflate,sdch
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8,fr;q=0.6
HTTP_CONNECTION: keep-alive
HTTP_COOKIE: __utma=174500448.1962665641.1384171110.1390811958.1397210442.3; __utmz=174500448.1384171110.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); PHPSESSID=b7b549346a2135b34c9e5d830bb8cc4d; cmsa=1; _gat=1; _ga=GA1.3.1294763715.1380797106
HTTP_HOST: shootersportsbar.co.uk
HTTP_REFERER: https://shootersportsbar.co.uk/admin/core/settings/diagnostics/
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
PATH: /bin:/usr/bin
PHPRC: /home/ouykunoh
QUERY_STRING: extended
REDIRECT_STATUS: 200
REMOTE_ADDR: 86.2.224.225
REMOTE_PORT: 63092
REQUEST_METHOD: GET
REQUEST_SCHEME: http
REQUEST_URI: /admin/core/settings/diagnostics/?extended
SCRIPT_FILENAME: /home/ouykunoh/public_html/admin/core/settings/diagnostics/index.php
SCRIPT_NAME: /admin/core/settings/diagnostics/index.php
SERVER_ADDR: 87.117.252.149
SERVER_ADMIN: webmaster@shootersportsbar.co.uk
SERVER_NAME: shootersportsbar.co.uk
SERVER_PORT: 80
SERVER_PROTOCOL: HTTP/1.1
SERVER_SOFTWARE: Apache
UNIQUE_ID: VDK6yVd1-JUAADXJBtgAAAAR
PHP_SELF: /admin/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1412610761.7149
REQUEST_TIME: 1412610761
argc: 1
Fishtank Creative

Fishtank Creative 2 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

If you add debug to your page, what does it output after you submit the form?

I get this:

Array

(

    [cv] => filetype

)


SELECT regionKey, regionHTML FROM perch2_content_regions 
WHERE regionPage='/careers/index.php' OR regionPage='*' ORDER BY regionPage DESC
SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch2_content_regions WHERE regionKey='Careers' AND (regionPage='/careers/index.php' OR regionPage='*')
SELECT * FROM ( SELECT idx.itemID, c.regionID, idx.pageID, c.itemJSON, idx2.indexValue as sortval FROM perch2_content_index idx 
JOIN perch2_content_items c ON idx.itemID=c.itemID AND idx.itemRev=c.itemRev AND idx.regionID=c.regionID
JOIN perch2_content_index idx2 ON idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev AND idx2.indexKey='_order' WHERE ((idx.regionID='45' AND idx.itemRev='1')) AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev
) as tbl GROUP BY itemID ORDER BY sortval ASC 
Using template: /templates/content/careers/listing.html
Array

(

    [type] => 32

    [message] => PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20100525/zip.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20100525/zip.so: cannot open shared object file: No such file or directory

    [file] => Unknown

    [line] => 0

)

When I remove the CV field, The form submits no problem. So must be a file upload issue.

I managed to get this working by changing the following:

Instead of using <?php perch_content('Job Applications'); ?> I used the following <?php perch_form('job_applications.html'); ?>

Created a forms folder inside templates and added the job_applications.html file in the forms folder.

Then instead of adding a content tag for a thankyou message I added it as text

<perch:success>
        <p>Thankyou for applying for one of Jobs here at Shooters Sports bar, your application has been submitted. We will reply to you as soon as possible.</p>
    </perch:success>

This now works. Strange why it didnt work the other way.

Drew McLellan

Drew McLellan 2638 points
Perch Support

What type of file were you uploading?

It was a PDF

Drew McLellan

Drew McLellan 2638 points
Perch Support

You've set accept="pdf doc" - have you defined those in your filetypes.ini file?

I haven't done this. I thought this was done automatically.

Drew McLellan

Drew McLellan 2638 points
Perch Support

That's why you're getting the validation failure.