Skip Navigation

[Resolved] Submission form error

This support ticket is created 6 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 39 replies, has 3 voices.

Last updated by leilaG 5 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#1108420
error.png

hidden link

We are getting an error message for submitting this form (image attached)

It's been working okay until today.

#1109040

Hi, do you have a test environment set up where we can run some tests?
- Temporarily deactivate all plugins except Types, Views, Layouts and Forms, and activate a default theme like Twenty Seventeen. Test again.
- If the problem was resolved, reactivate your theme and plugins one by one until the problem returns.
- If the problem was not resolved, please check the server logs for any errors that correspond to these Form submissions. If you're not familiar with server logs, I can show you how to activate them temporarily. Go in your wp-config.php file and look for

define('WP_DEBUG', false);

Change it to:

define('WP_DEBUG', true);

Then add these lines, just before it says 'stop editing here':

ini_set('log_errors',TRUE);
ini_set('error_reporting', E_ALL);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');

Submit the Form once again to trigger the error message. If any back-end errors are thrown, this will create an error_log.txt file in your site's root directory. Please send me its contents. Once that is done, you can revert the changes you made to wp-config.php.

#1109056
invalid-key.PNG

Hey, I deactivated all plugins and theme on the staging site, but the recaptcha became invalid (image attached)

#1109445

Okay to proceed on staging you can either:
1. Create a new recaptcha api key for the staging site URL and apply the new key in Toolset > Settings > Forms.
or
2. Temporarily remove the recaptcha field from the Form.

#1109535
problem-cred-form.PNG

I activated the Bridge theme instead of Bridge child and the form works, so I don't know what could be causing the problem with the child theme.

Also other parts of the form have stopped working (image attached) hidden link

Very odd as we have a similar form that is working just fine - hidden link

#1109726
Screen Shot 2018-09-17 at 5.12.11 PM.png

Also other parts of the form have stopped working (image attached)
You're referring to this Form:
hidden link
The problem is this Form is configured to create Posts, but the problem fields do not apply to Posts. The fields apply to Companies. The Form should be modified to create Companies, or the fields should be applied to Posts in Toolset > Custom Fields > Post Fields, depending on what you want to do here.

I activated the Bridge theme instead of Bridge child and the form works, so I don't know what could be causing the problem with the child theme.
Our support policy states we do not troubleshoot problems in custom themes, so my best advice is to comment out code in your child theme iteratively until you can isolate a conflict. Once that conflict is pinpointed, I will be glad to take a closer look.

#1110427

I have done some trouble shooting and found that the problem is in the code in functions.php

But this code was given by toolset support and was working with no issues before -

When I remove the below code the error is gone.

add_filter('cred_subject_notification_codes', 'custom_generic_field_notification', 10, 1);
 
add_filter('cred_body_notification_codes', 'custom_generic_field_notification', 10, 1);
 
function custom_generic_field_notification( $defaultPlaceHolders ) {
 
$newPlaceHolders = array(
'%%NAME%%' => $_REQUEST['Name'],
'%%EMAIL%%' => $_REQUEST['Email'],
'%%COMPANY_NAME%%' => $_REQUEST['company_name']

);
 
return array_merge($defaultPlaceHolders, $newPlaceHolders );
}


function tssupp_false_body( $post_id, $form_data ){
$forms = array( 17097,17313,17296 );
 
if ( in_array($form_data['id'], $forms) ){
$false_body = $_POST['description'];
 
if ( $false_body ) {
 
$args = array(
'ID' => $post_id,
'post_content' => $false_body
);

wp_update_post( $args );
}
}
}
add_action( 'cred_save_data', 'tssupp_false_body', 10, 2 );

add_filter('cred_form_validate_17097','validate_my_form_17097',10,2);
function validate_my_form_17097( $field_data, $form_data) {
    // Split $field_data into separate $fields and $errors
list( $fields,$errors ) = $field_data;
 
    
                // check at least one of required taxonomies set
                    if ( empty( $fields['contract-research']['value']) && 
					     empty( $fields['environmental']['value']) && 
						 empty( $fields['medtech']['value']) && 
						 empty( $fields['professional-services']['value']) && 
						 empty( $fields['therapeutics']['value']) && 
						 empty( $fields['wellness']['value']) 
						 
						 ) {
              
                        $errors['contract-research'] = 'Environmental, Medtech, Professional Services, Therapeutics, Wellness:  You must choose at least one sector';
                    }
 
                    if ( empty( $fields['location']['value']) ) {
               
                        $errors['location'] = 'You must select a location';
                    }
                    if ( empty( $fields['company-type']['value']) ) {
               
                        $errors['company-type'] = 'You must select a company type';
                    }
            
        return array($fields,$errors);
}

add_filter('cred_form_validate_17313','validate_my_form_17313',10,2);
function validate_my_form_17313( $field_data, $form_data) {
    // Split $field_data into separate $fields and $errors
list( $fields,$errors ) = $field_data;
  
                // check at least one of required taxonomies set
                    if ( empty( $fields['location']['value']) ) {
               
                        $errors['location'] = 'You must select a location';
                    }
                    if ( empty( $fields['job-category']['value']) ) {
               
                        $errors['job-category'] = 'You must select a job category';
                    }	   
             
        return array($fields,$errors);
}

add_filter('cred_form_validate_17825','validate_my_form_17825',10,2);
function validate_my_form_17825( $field_data, $form_data) {
    // Split $field_data into separate $fields and $errors
list( $fields,$errors ) = $field_data;
  
                // check at least one of required taxonomies set
                    if ( empty( $fields['location']['value']) ) {
               
                        $errors['location'] = 'You must select a location';
                    }
                    if ( empty( $fields['type-of-space']['value']) ) {
               
                        $errors['type-of-space'] = 'You must select a job category';
                    }
                    if ( empty( $fields['availability']['value']) ) {
               
                        $errors['availability'] = 'You must select a job category';
                    }					
             
        return array($fields,$errors);
}

function customise_cred_notifications( $headers, $formid, $postid, $notification_name, $notification_number ) {
 
 $form_ids_array= array( 17097,17296,17313 );
if (in_array($formid , $form_ids_array)) {
 
$sender_email = $_REQUEST['Email'];
$sender_name = $_REQUEST['Name'];
$myheaders = array( "From: " . $sender_name . " <" . $sender_email . ">" );
return array_merge($headers, $myheaders);
}
return $headers;
}
add_filter('cred_mail_header', 'customise_cred_notifications', 10, 5);
#1110692

I'm trying to check the JavaScript settings in this Form, but there is a JavaScript error on the page and I cannot use the Form editor panels: hidden link

At this point it's probably best for me to run some tests on a local copy of your site. I would like to install the Duplicator plugin to create that site clone. It that is okay with you, I'll get started. Please let me know if you approve.

#1111358

Yes I approve.

We will probably get prompted from WPENGINE soon after to delete the plugin as its one of their disallowed plugins, due to them providing similar features already.

#1111673

Hmm, none of my cloning software works well on WPEngine. I'll need to work with a database dump file from your site. Can you provide a download link for me in the private reply fields here? It may say "Duplicator" but any download link will be fine. I will try to add this code to a custom theme and see if I can replicate the issue.

#1112253

Hi, the private reply I received didn't include a download link. Can you submit that again please?

#1112370

Okay I got the link this time but I'm seeing an ellipsis in the URL like this (I omitted some characters here for security, but you can see the problem):

<em><u>hidden link</u></em>

We released some updates to the Forum earlier today, so I'm not sure if this is related or if it's a typo/transcription error. Can you please submit once more and verify the link you submit has no ellipsis? I apologize for the extra hassle, I want to be able to report this as an error if necessary.

#1112402

I think this backup is a different site - hidden link. I see a mysql.sql file in wp-content, but it's not from hidden link. There is no post 17097, for example. That should exist, it's a Form. Also, there are no Toolset plugins in the plugin directory, which isn't a problem really but is a pretty strong indicator that this isn't a backup of the same site.

#1115048

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Leila,

As Christian is currently on vacation I will be handling this ticket for you/

I'm up to speed with the issue here but could you provide access to the site as well ? I may not be able to setup the copy of the site from the files provided so being able to look at the site and the form directly will help to speed things up a bit.

Thanks,
Shane

#1115218

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Leila,

It seems that the account isn't an admin account so i'm not able to check on the form on the backend.

Could you update the role to an admin account so that I can check on this ?

Thanks,
Shane