Skip Navigation

[Waiting for user feedback] Error upon submitting form with empty multiple-line custom field

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 3 replies, has 1 voice.

Last updated by Christopher Amirian 20 hours, 1 minute ago.

Assisted by: Christopher Amirian.

Author
Posts
#2797047

I have a form created with Toolset Forms various fields. One of them is a multiple single line custom field. When testing the form leaving this field empty, I get the error message upon submission:

Fatal error: Uncaught TypeError: array_filter(): Argument #1 ($array) must be of type array, string given in .../plugins/cred-frontend-editor/application/controllers/validators/toolset_forms.php:101

I temporarily resolved the issue by replacing L. 98 of that file:
if ( is_null( $_values ) ) {
By:
if ( is_null( $_values ) or empty($_values) ) {

The reason I did this is that when the field is not filled by the user, $_values is empty, but it's not null and it's not fulfilling the condition empty($config['repetitive']) either (see L. 95). So it stays '' and is not changed into an array. Due to that, L. 101 fails.

This is a new issue that was not there before I updated from my old version of CRED to version 2.6.22.

Is that a bug or am I missing something?

Thanks!

#2797335

Christopher Amirian
Supporter

Languages: English (English )

Hi,

Welcome to Toolset support. Would you please create the same scenario in a clean installation below?

hidden link

If it is possible to replicate the empty single-line problem there, I will immediately report this to the second-tier support to follow up with the development team.

Thanks.

#2797521

Hi,
Thanks, I was able to recreate the issue on the sandbox. To see the issue, go to hidden link, select "Receive updates", and click "Send". There is a critical error. The critical error does not happen when the radio is set to another position. The issue seems to arise only when there is a conditional cred_show_group inside another one.
Thanks for your help!

#2797834

Christopher Amirian
Supporter

Languages: English (English )

Screenshot 2025-02-23 at 9.34.33 PM.png

Hi,

Thank you for the details. I checked and it seems that you used the value name of the radio box and that is the issue.

Please use 1, 2, 3 instead of the values themselves as it is set in the custom field.

I used 1 for cred_show_group and it seems to be working ok on registration type radio box.

Thanks.