Custom Fields
Re-Envisioned
Support MB Frontend Submission [FRONT END SUBMISSION] Id on form rendered

  • Creator
    Topic
  • #23567
    Resolved Kevin
    Participant

    Hi everyone @mb.io
    Mostly a suggestion than a support topic, you should add the form id to the rendered frontend form

    in wp-content/plugins/meta-box-aio/vendor/meta-box/mb-frontend-submission/src/Form.php
    Line 59

    Change
    echo '<form class="rwmb-form" method="post" enctype="multipart/form-data" encoding="multipart/form-data">';

    To
    echo '<form class="rwmb-form" id="'.$this->config['id'].'" method="post" enctype="multipart/form-data" encoding="multipart/form-data">';

    It would be easier to, for example, target a specific form when you have multiple form on the same page, with a script or a style.

    Maybe there's a better way i am not aware of, havn't found this in docs (?).

    Thanks again for your great works.
    KL

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #23571
    Long Nguyen
    Moderator

    Hi Kevin,

    Thank you for your idea. I will create a feature request for the developer team to support adding the form ID by using meta box ID.

    For now, we can use two hooks rwmb_frontend_before_form and rwmb_frontend_after_form to create a wrapper for the form with the meta box ID.

    add_action( 'rwmb_frontend_before_form', function( $config ) {
        echo '<div id="' . $config['id'] . '" class="form-wrapper">';
    } );
    
    add_action( 'rwmb_frontend_after_form', function( $config ) {
        echo '</div>';
    } );

    Get more details in the documentation https://docs.metabox.io/extensions/mb-frontend-submission/#general-hooks.

    #23572
    Kevin
    Participant

    Hi Long,
    Thanks for your quick reply,
    i'll use the hook for now, and really hope that my feature requests will be implemented, that would be nice !

    have a nice day,
    KL

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