MB jQuery Validation - Scroll To Highlight Error - file_upload - Issue

Support MB Frontend Submission MB jQuery Validation - Scroll To Highlight Error - file_upload - Issue

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #47323
    CodogCodog
    Participant

    Hi 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 the file_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.

    #47337
    PeterPeter
    Moderator

    Hello,

    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.

    #47338
    CodogCodog
    Participant

    Hi 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 🙂

    #47345
    PeterPeter
    Moderator

    Here 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.

    #47347
    CodogCodog
    Participant

    Hi 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 the file_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?

    #47352
    PeterPeter
    Moderator

    Hello,

    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.

    #47354
    CodogCodog
    Participant

    Hi Peter,
    thanks for letting me know and I look forward to the fix 🙂

    #47771
    CodogCodog
    Participant

    Hi there,
    is there any news on this fix? Or when this is likely to be addressed?

    Cheers 🙂

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.