Skip Navigation

[Escalated to 2nd Tier] 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 7 replies, has 1 voice.

Last updated by Christopher Amirian 3 months, 3 weeks 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.

#2799081

Hi Christopher,

I think you used the following in the sandbox:
[cred_show_group if="($(registration-type) ne '0' )" mode="fade-slide"]
which will lead to no reaction when you switch the radio button, and this whether the numerical or the slug is accepted. So, it's not testing anything (unless I missed something).

So to follow your suggestion, I changed it to the following in the sandbox:
[cred_show_group if="($(registration-type) eq '1' )" mode="fade-slide"]
I expect the inner part to display when the radio is in the first position only.
But there is no reaction when I switch the radio button from 1 to 2 to 3. In my understanding, this is because the custom field is set to take fields from the database, and this is what I need to do here.

So, I think we're back to square zero, with the problem still there. You can test this on the sandbox page /test-page.

Thanks for your help!

#2799267

Christopher Amirian
Supporter

Languages: English (English )

Hi,

Than k you for your reply. WOuld you please check the video below and confirm if I understood the situation correctly?

hidden link

Thanks.

#2799272

Hi Christopher,
Thanks, yes that is absolutely correct. The issue arises with 2 nested conditional groups and with empty multi-single line fields.
Thanks for your help and let me know when it's resolved.

#2799283

Christopher Amirian
Supporter

Languages: English (English )

Thank you. I reported the problem to the second-tier support.

I will get back to you as soon as I have news.

If needed, they will report this to the development team.