Skip Navigation

[Resolved] Form gives critical error on submission

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.

This topic contains 0 replies, has 1 voice.

Last updated by Ian 4 weeks ago.

Assisted by: Christopher Amirian.

Author
Posts
#2805167

Ian
error.jpeg
form.jpeg

I have a front end form and if you change the field labeled "Products or Services" the form gives a critical error when submitted.

I have another form with the same field in it and it gives the same error.

I have other custom fields and forms with radio buttons and they work fine.

I tried creating a new custom field that duplicated the functionality of the first one and it also gives the same error.

#2805281

Christopher Amirian
Supporter

Languages: English (English )

Hi,

Welcome to Toolset support. Would you please first test to see if it works on a minimal installation?

- IMPORTANT STEP! Create a backup of your website. Or better approach will be to test this on a copy/staging version of the website to avoid any disruption of a live website.
- Switch to the default theme such as "TwentyTwenty" by going to "WordPress Dashboard > Appearance > themes".
- Go to "WordPress Dashboard > Plugins" and deactivate all plugins except Toolset and its add-ons.
- Check if you can still recreate the issue.
- If not, re-activate your plugins one by one and check the issue each time to find out the plugin that causes the problem.

If the problem still happens please nebale the debug mode in WordPress to give us the error under the hood:

Would you please access your website files and edit the "wp-config.php" file on the root folder of your WordPress installation and add the code below into the file:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', true );

Please add the code above the line below:

/* That's all, stop editing! Happy blogging. */

For more information:
https://wpml.org/documentation/support/debugging-wpml/

And finally I wonder what are the characterstics of that specific field that might have an effect? Any custom thing you add or do?

Thanks.

#2805370

Ian

OK did all the testing you requested and the problem persists.

Turned on Debug and got the following error on submitting the form:

Fatal error: Uncaught TypeError: array_filter(): Argument #1 ($array) must be of type array, string given in /www/wp-content/plugins/cred-frontend-editor/application/controllers/validators/toolset_forms.php:101 Stack trace: #0 /www/wp-content/plugins/cred-frontend-editor/application/controllers/validators/toolset_forms.php(101): array_filter('') #1 /www/wp-content/plugins/cred-frontend-editor/application/controllers/validators/form.php(49): CRED_Validator_Toolset_Forms->validate() #2 /www/wp-content/plugins/cred-frontend-editor/application/models/form/base.php(974): CRED_Validator_Form->validate() #3 /www/wp-content/plugins/cred-frontend-editor/application/models/form/base.php(423): CRED_Form_Base->validate_form(NULL) #4 /www/wp-content/plugins/cred-frontend-editor/application/controllers/form_builder_base.php(42): CRED_Form_Base->print_form() #5 /www/wp-content/plugins/cred-frontend-editor/library/toolset/cred/embedded/classes/CRED_Helper.php(1799): CRED_Form_Builder_Base->get_form(2215, '') #6 /www/wp-content/plugins/cred-frontend-editor/library/toolset/cred/embedded/classes/CRED_Helper.php(2398): CRED_Helper::cred_form('edit-products-a...', '') #7 /wordpress/wp-includes/shortcodes.php(434): CRED_Helper::credFormShortcode(Array, '', 'cred-form') #8 [internal function]: do_shortcode_tag(Array) #9 /wordpress/wp-includes/shortcodes.php(273): preg_replace_callback('/\\[(\\[?)(icon|c...', 'do_shortcode_ta...', '
render() #22 /wordpress/wp-includes/class-wp-block.php(517): WP_Block->render() #23 /wordpress/wp-includes/class-wp-block.php(517): WP_Block->render() #24 /wordpress/wp-includes/class-wp-block.php(517): WP_Block->render() #25 /wordpress/wp-includes/blocks.php(2191): WP_Block->render() #26 /wordpress/wp-includes/blocks.php(2243): render_block(Array) #27 /wordpress/wp-includes/class-wp-hook.php(324): do_blocks('

#2805614

Christopher Amirian
Supporter

Languages: English (English )

Hi,

Thank you for sharing the error. This typically happens if you have wrong nested conditionals on the form. Is that what you do?

If not, I'd appreciate it if you could give me the URL/User/Pass of your WordPress dashboard after you make sure that you have a backup of your website.
It is absolutely important that you give us a guarantee that you have a backup so if something happens you will have a point of restore.

Make sure you set the next reply as private.

Please tell me which form to check and the page that form is one with the custom fields involved.

Thanks.

#2805780

Christopher Amirian
Supporter

Languages: English (English )

Hi,

Thank you for the login information. The admin login worked but the other one did not. I tried to check the admin one but I do not see any Edit link to be able to click to access the Form.

Would you please give me the steps with screenshots?

Also I wonder if the same thing happens on a minimal installation?

- IMPORTANT STEP! Create a backup of your website. Or better approach will be to test this on a copy/staging version of the website to avoid any disruption of a live website.
- Switch to the default theme such as "TwentyTwenty" by going to "WordPress Dashboard > Appearance > themes".
- Go to "WordPress Dashboard > Plugins" and deactivate all plugins except Toolset and its add-ons.
- Check if you can still recreate the issue.
- If not, re-activate your plugins one by one and check the issue each time to find out the plugin that causes the problem.

Thanks.

#2805915

Christopher Amirian
Supporter

Languages: English (English )

Hi,

Thank you for the information. I tried to find why this is happening and I think it depends on the fact that you have some conditionals on the Product/Service field that shows or hides:

hidden link

I tried to find where it is and what is the code but I could not. Would you pelase tell me where you added the logic and if you remove the logic does it work or not?

#2806045

Ian

So there was a conditional on the field "Vendor Product" set in the custom fields area. This worked fine but once the conditional was added to the front end form for the submit button the error was generated.

I would really like to see a number of improvements to forms:
• Being able to set required items in the custom fields area and have that reflected in the front end forms.
• Being able to show the field descriptions from custom fields in the front end forms
• Perhaps even adding another field for help.
• Being able to display that information as inline or as tooltips, like you see in my forms

Thanks for the help