Skip Navigation

[Resolved] cred_form_validate filer doesn't work for CRED forms

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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 19 replies, has 3 voices.

Last updated by cassianS 1 year, 8 months ago.

Assisted by: Minesh.

Author
Posts
#2577835

Hi Minesh, thank you again.
I made test form submissions and unfortunately, I couldn't submit a form with .dcm file.
I got an error message "Error some required upload field failed" even though all fields were filled. Please see the HTML element with this message below. Form submissions with other file types were successful.

<div id="lbl_Post Title" class="wpt-form-error alert alert-danger">Error some required upload field failed.</div>

Also, I see PHP warning message during a try of form submission with .dcm file:

Warning: Illegal string offset 'upload_fail' in /wp-content/plugins/cred-frontend-editor/library/toolset/cred/embedded/classes/Form_Builder_Helper.php on line 1907

Warning: Illegal string offset 'label' in /wp-content/plugins/cred-frontend-editor/library/toolset/cred/embedded/classes/Form_Builder_Helper.php on line 1911

Notice: Object of class WP_Error could not be converted to int in /wp-content/plugins/cred-frontend-editor/application/controllers/notification_manager/post.php on line 229

Notice: Object of class WP_Error could not be converted to int in /radiologyportal/wp-content/plugins/cred-frontend-editor/library/toolset/cred/embedded/models/Forms.php on line 365

Warning: Illegal offset type in /radiologyportal/wp-content/plugins/cred-frontend-editor/library/toolset/cred/embedded/models/Forms.php on line 365

Warning: Illegal offset type in /radiologyportal/wp-content/plugins/cred-frontend-editor/library/toolset/cred/embedded/models/Forms.php on line 368
#2577837

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

That is really strange. That is why I will require the same file you are trying to upload.

Can you please upload the file that you are trying to upload on any file sharing service and send me link to download it and let me review whats going wrong.

I have set the next reply to private which means only you and I have access to it.

#2577865

Sure, Minesh. Here are two files I downloaded as sample files and which I used for test form submissions: hidden link

#2578253

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

The issue was with your file extension.

The files you are trying to upload is with .DCM (in capital letters) and the files I try to upload is with .dcm (small letter) and we added the mime type for the .dcm not for .DCM.

So I've adjusted the code as given under for the upload_mimes to the "Custom Code" seciton:

add_filter( 'upload_mimes', 'func_allow_dcm_file_uploads' );
function func_allow_dcm_file_uploads( $mimes ) {
  
  	
    $mimes['DCM'] = 'application/dicom';
    $mimes['dcm'] = 'application/dicom';
   
    return $mimes;
}

Where as you may notice we allow the DCM now.

Can you please check now I hope this time you should be able to mark resolve this ticket. You may add different message like "This issue is really resolved" or any other message you would like as you will not be able to mark resolve this ticket with the same text.

#2578583

Fantastic! Thank you, Minesh. Now everything works perfectly fine.