We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Problem

Problem with perch forms

Having a bit of trouble with the forms app as it seems to have stopped storing responses though it is still processing them - emails are being sent fine.

I have a feeling that I broke it somehow when I moved from calling the form with perch_form() to perch_content()... I tried starting a new form by changing the form id in the template but have the same problem.

Any thoughts on how I should go about debugging this?

I've pasted the template below:

<h2><perch:content id="title" title="true" type="text" label="title" /></h2> 
<perch:content id="introduction" type="textarea" size=m label="introduction" markdown />    

<perch:form id="signup" method="post" app="perch_mailchimp perch_forms">
    <div class="input">
        <perch:label for="first_name">First name:</perch:label>
        <perch:input id="first_name" type="text" label="First Name" required="true" mailer="FNAME" />
        <perch:error for="first_name" type="required">Please add your first name</perch:error>
    </div>
    <div class="input">
        <perch:label for="last_name">Last name:</perch:label>
        <perch:input id="last_name" type="text" label="Last Name" required="true" mailer="LNAME" />
        <perch:error for="last_name" type="required">Please add your last name</perch:error>
    </div>
    <div class="input">
        <perch:label for="email">email:</perch:label>
        <perch:input id="email" type="email" label="Email" required="true" mailer="email" />
        <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 class="input">
        <perch:label for="performer">instrument or voice type:</perch:label>
        <perch:input id="performer" label="Performer" type="text">
    </div>
    <div class="input">
        <label for="submit"> </label>
        <perch:input id="btnsubmit" type="submit" value="Send" />
        <perch:input type="hidden" value="1" id="confirm" mailer="confirm_subscribe" />
        <perch:input type="hidden" id="list" value="81f2b01cf0" mailer="list" />
    </div>
    <perch:success>
    <div class="success">
        <h3>Success!</h3>
        <p>Your details have been submitted, thank you!</p>
    </div>
    </perch:success>
</perch:form>
Owain Browne

Owain Browne 0 points

  • 2 months ago
Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Hello Owain,

The size attribute in the introduction field tag is missing the quotes (size="m").

I broke it somehow when I moved from calling the form with perch_form() to perch_content()

If you're using perch_content(), you also need to re-save the region when you make changes to the template.

Thanks for spotting that but I’m not sure it would have had any effect on the form... the form is being processed by perch forms and is sending its data out in email, it’s just that the responses don’t appear in the admin interface... it says that there are 0 responses and that the last was in 1970...

Drew McLellan

Drew McLellan 2637 points
Perch Support

Try turning on debug and then submitting the form. What does it output?

I have the debug settings on but where should I be looking for the output after I submit a form? On the Forms app page? Apologies if that's a stupid question!

Edit to add: In the database, the form exists with formID 5 but no responses are being written to perch3_forms_responses...

Oh, and it still both sends me an email with the correct template and the Mailchimp app processes the form properly...

Drew McLellan

Drew McLellan 2637 points
Perch Support

You should be looking for the output on your page after submitting the form.

Ah, sorry... I had debug turned on but had never added the function to any of my pages - was only looking in the admin interface.

Here's the output (with some errors)

Debug Message - Perch 3.1.4
[26] SELECT DISTINCT settingID, settingValue FROM perch3_settings WHERE userID=0
[1] SELECT * FROM perch3_mailchimp_lists WHERE listMailChimpID='81f2b01cf0' LIMIT 1
Subscribing to: Bildeston Waytes
Array
(
    [headers] => Array
        (
            [url] => https://us17.api.mailchimp.com/3.0/lists/81f2b01cf0/members
            [content_type] => application/problem+json; charset=utf-8
            [http_code] => 400
            [header_size] => 563
            [request_size] => 437
            [filetime] => -1
            [ssl_verify_result] => 0
            [redirect_count] => 0
            [total_time] => 0.394121
            [namelookup_time] => 0.004261
            [connect_time] => 0.011797
            [pretransfer_time] => 0.041128
            [size_upload] => 102
            [size_download] => 215
            [speed_download] => 545
            [speed_upload] => 258
            [download_content_length] => 215
            [upload_content_length] => 102
            [starttransfer_time] => 0.394013
            [redirect_time] => 0
            [redirect_url] => 
            [primary_ip] => 104.123.122.65
            [certinfo] => Array
                (
                )

            [primary_port] => 443
            [local_ip] => 10.27.35.12
            [local_port] => 50306
            [request_header] => POST /3.0/lists/81f2b01cf0/members HTTP/1.0
Host: us17.api.mailchimp.com
User-Agent: DrewM/MailChimp-API/3.0 (github.com/drewm/mailchimp-api)
Accept-Encoding: deflate, gzip
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Authorization: apikey 1d3064f8635025507fd04ae27f656d41-us17
Content-Length: 102


        )

    [body] => {"type":"http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/","title":"Invalid Resource","status":400,"detail":"test@test.com looks fake or invalid, please enter a real email address.","instance":"a69b2c02-2681-4494-af3b-11687aa2f369"}
)
[1] SELECT * FROM perch3_forms WHERE formKey='signup' LIMIT 1
[1] SELECT * FROM perch3_pages WHERE pagePath='/contact.php' LIMIT 1
Array
(
    [fields] => Array
        (
        )

    [files] => Array
        (
        )

    [page] => Array
        (
            [id] => 10
            [title] => Contact
            [path] => /contact.php
            [navtext] => Contact
        )

)
Using email template: /customers/8/2/9/bildestonwaytes.com/httpd.www/perch/templates/forms/emails/new_signup.html (html)
Setting first_name as test
Setting last_name as test
Setting email as test@test.com
Setting performer as
Setting confirm as 1
Setting list as 81f2b01cf0
Building message with Perch template
[1] Using template: /templates/forms/emails/new_signup.html
Sent email: "New Waytes Signup!" to owain.browne@gmail.com
INSERT INTO perch3_forms_responses(responseJSON,formID,responseIP,responseSpamData) VALUES('{\"fields\":{\"first_name\":{\"attributes\":{\"id\":\"first_name\",\"type\":\"text\",\"label\":\"First Name\",\"required\":\"true\",\"mailer\":\"FNAME\",\"\":true},\"value\":\"test\"},\"last_name\":{\"attributes\":{\"id\":\"last_name\",\"type\":\"text\",\"label\":\"Last Name\",\"required\":\"true\",\"mailer\":\"LNAME\",\"\":true},\"value\":\"test\"},\"email\":{\"attributes\":{\"id\":\"email\",\"type\":\"email\",\"label\":\"Email\",\"required\":\"true\",\"mailer\":\"email\",\"\":true},\"value\":\"test@test.com\"},\"performer\":{\"attributes\":{\"id\":\"performer\",\"label\":\"Performer\",\"type\":\"text\"},\"value\":\"\"},\"confirm\":{\"attributes\":{\"type\":\"hidden\",\"value\":\"1\",\"id\":\"confirm\",\"mailer\":\"confirm_subscribe\",\"\":true},\"value\":\"1\"},\"list\":{\"attributes\":{\"type\":\"hidden\",\"id\":\"list\",\"value\":\"81f2b01cf0\",\"mailer\":\"list\",\"\":true},\"value\":\"81f2b01cf0\"}},\"files\":[],\"page\":{\"id\":\"10\",\"title\":\"Contact\",\"path\":\"\\/contact.php\",\"navtext\":\"Contact\"}}','5','2a01:4b00:8e12:2000:4195:2f2b:4ef0:8187','{\"fields\":[],\"environment\":{\"ONECOM_DOMAIN_NAME\":\"bildestonwaytes.com\",\"ONECOM_DOMAIN_ROOT\":\"\\/customers\\/8\\/2\\/9\\/bildestonwaytes.com\\/\",\"ONECOM_MEMORYLIMIT\":\"1073741824\",\"ONECOM_CPU_SHARES\":\"1024\",\"ONECOM_EXEC\":\"php7.1\",\"ONECOM_DIR_LAYOUT_VER\":\"0\",\"HTTP_CONNECTION\":\"close\",\"SCRIPT_NAME\":\"\\/contact.php\",\"REQUEST_URI\":\"\\/contact.php\",\"QUERY_STRING\":\"\",\"REQUEST_METHOD\":\"POST\",\"SERVER_PROTOCOL\":\"HTTP\\/1.1\",\"GATEWAY_INTERFACE\":\"CGI\\/1.1\",\"REMOTE_PORT\":\"40020\",\"SCRIPT_FILENAME\":\"\\/customers\\/8\\/2\\/9\\/bildestonwaytes.com\\/httpd.www\\/contact.php\",\"SERVER_ADMIN\":\"support@one.com\",\"CONTEXT_DOCUMENT_ROOT\":\"\\/var\\/www\",\"CONTEXT_PREFIX\":\"\",\"REQUEST_SCHEME\":\"http\",\"REMOTE_ADDR\":\"2a01:4b00:8e12:2000:4195:2f2b:4ef0:8187\",\"SERVER_PORT\":\"80\",\"SERVER_ADDR\":\"10.27.35.12\",\"SERVER_NAME\":\"www.bildestonwaytes.com\",\"SERVER_SOFTWARE\":\"Apache\",\"SERVER_SIGNATURE\":\"\",\"PATH\":\"\\/usr\\/local\\/sbin:\\/usr\\/local\\/bin:\\/usr\\/sbin:\\/usr\\/bin:\\/sbin:\\/bin\",\"HTTP_X_VARNISH\":\"544967962\",\"HTTP_X_ONECOM_HOST\":\"bildestonwaytes.com\",\"HTTP_X_FORWARDED_PROTO\":\"http\",\"HTTP_X_ONECOM_FORWARDED_PROTO\":\"http\",\"HTTP_X_FORWARDED_FOR\":\"2a01:4b00:8e12:2000:4195:2f2b:4ef0:8187\",\"HTTP_COOKIE\":\"PHPSESSID=94752b9474597e75ab7643c00bfa5c0e; cmsa=1\",\"CONTENT_LENGTH\":\"220\",\"HTTP_REFERER\":\"http:\\/\\/www.bildestonwaytes.com\\/contact.php\",\"HTTP_UPGRADE_INSECURE_REQUESTS\":\"1\",\"HTTP_USER_AGENT\":\"Mozilla\\/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit\\/605.1.15 (KHTML, like Gecko) Version\\/12.0.2 Safari\\/605.1.15\",\"HTTP_ORIGIN\":\"http:\\/\\/www.bildestonwaytes.com\",\"CONTENT_TYPE\":\"application\\/x-www-form-urlencoded\",\"HTTP_ACCEPT_LANGUAGE\":\"en-gb\",\"HTTP_ACCEPT_ENCODING\":\"gzip, deflate\",\"HTTP_ACCEPT\":\"text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,*\\/*;q=0.8\",\"HTTP_HOST\":\"www.bildestonwaytes.com\",\"ENV_VCV_ENV_ADDONS_ID\":\"one.com\",\"ENV_VCV_TOKEN_URL\":\"https:\\/\\/wpapi.one.com\\/api\\/v1.0\\/plugins\\/visualcomposer\\/activate\",\"ONECOM_WP_ADDONS_API\":\"https:\\/\\/wpapi.one.com\",\"ONECOM_WEBSHOP_HOST\":\"webshop2.cst.webpod8-cph3.one.com\",\"ONECOM_TMPDIR\":\"\\/customers\\/8\\/2\\/9\\/bildestonwaytes.com\\/\\/tmp\",\"DOMAIN_NAME\":\"bildestonwaytes.com\",\"ONECOM_DOCUMENT_ROOT\":\"\\/customers\\/8\\/2\\/9\\/bildestonwaytes.com\\/httpd.www\",\"DOCUMENT_ROOT\":\"\\/customers\\/8\\/2\\/9\\/bildestonwaytes.com\\/httpd.www\",\"FCGI_ROLE\":\"RESPONDER\",\"PHP_SELF\":\"\\/contact.php\",\"REQUEST_TIME_FLOAT\":1547131198.8104560375213623046875,\"REQUEST_TIME\":1547131198}}')
Invalid query: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'responseIP' at row 1
[1] SELECT regionKey, regionHTML FROM perch3_content_regions WHERE regionPage='/contact.php' OR regionPage='*' ORDER BY regionPage DESC
Array
(
    [type] => 8
    [message] => mail(): Policy restriction in effect.  The fifth parameter is disabled on this system
    [file] => /customers/8/2/9/bildestonwaytes.com/httpd.www/perch/core/lib/PHPMailer.class.php
    [line] => 707
)
Drew McLellan

Drew McLellan 2637 points
Perch Support

It looks like your server has an IPv6 address, which is causing issues. You should be able to fix it with:

ALTER TABLE `perch3_forms_responses` CHANGE `responseIP` `responseIP` VARCHAR(255) NOT NULL DEFAULT '';

This solved the problem - many thanks...