MB jQuery Validation - Scroll To Highlight Error - file_upload - Issue
Support › MB Frontend Submission › MB jQuery Validation - Scroll To Highlight Error - file_upload - Issue
- This topic has 7 replies, 2 voices, and was last updated 1 month, 1 week ago by
Codog.
-
AuthorPosts
-
January 7, 2025 at 7:33 PM #47323
Codog
ParticipantHi there,
I use the MB jQuery validation for many fields in my frontend submission form. After the "Submit" button is clicked and fields have missing or invalid data, the page scrolls up to show where errors have occurred and highlights them - which is great.This works fine on ALL fields except for the
file_upload
custom field? When clicking "submit" and ONLY thefile_upload
field is empty, the scroll (to the error) action either: 1) takes place but does not scroll all the way to the error? or 2) Does not take place at all? The "rwmb-error" class is shown below the field. This is problematic as I have a fairly lengthy form and the user has to scroll back up to locate the issue.I am only using the 'required' => true, validation attribute on the
file_upload
field. I see no errors in the browser console or in my error log file when this is triggered?Is this a bug? I would very much like to solve this problem.
I look forward to your response.
January 8, 2025 at 9:51 PM #47337Peter
ModeratorHello,
Thank you for your feedback.
I also see the required jQuery validation doesn't work with the file_upload field. However, you can use the required field setting as an alternative way to make the field mandatory.
January 8, 2025 at 10:07 PM #47338Codog
ParticipantHi Peter,
thanks for getting back to me. When you say ..."the required field setting as an alternative way"... Where is this alternative method documented?Secondly, will this alternative method solve the 'Scrolling to the error issue" I am highlighting?
Thanks in advance 🙂
January 8, 2025 at 11:10 PM #47345Peter
ModeratorHere is the "Required" field setting https://imgur.com/INH8uRy
it is available for all fields. And I see that it is scrolling to the error message when submitting the post.January 8, 2025 at 11:52 PM #47347Codog
ParticipantHi Peter,
appreciate the image reference, but I don't use the Metabox builder UI. I create my custom fields with PHP. I assume that the equivalent in my custom field declaration is simply'required' => true
? Which is what I am using an thefile_upload
custom field like this:[ 'name' => __( 'Image', 'text_domain' ), 'id' => '_thumbnail_id', 'type' => 'file_upload', 'max_file_size' => '2mb', 'max_file_uploads' => 1, 'required' => true, ],
This does not work as I have previously described? Or have I misunderstood your explanation?
January 9, 2025 at 8:28 PM #47352Peter
ModeratorHello,
Thanks for the feedback. I can reproduce the issue from scratch. I've escalated this issue to the development team to fix the jQuery validation and improve the behavior to scroll to the error message.
January 9, 2025 at 9:02 PM #47354Codog
ParticipantHi Peter,
thanks for letting me know and I look forward to the fix 🙂March 4, 2025 at 7:01 PM #47771Codog
ParticipantHi there,
is there any news on this fix? Or when this is likely to be addressed?Cheers 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.