Custom Fields
Re-Envisioned
Support MB Frontend Submission Multiple forms of same type on same page

  • Creator
    Topic
  • #29315
    Smiffy
    Participant

    My use case is for users to save and edit details about their children to be used when booking out sporting sessions. My implementation is outputting a front end form in a "foreach" loop so that each child can be seen on one page. I can see that there are duplicate ids and also, if there is a datepicker field, this only registers on the first field encountered and since there are multiple ids, this doesn't work as expected.

           foreach($children as $child) //child is post type
            {
                $shortcode = "[mb_frontend_form id='88' post_fields='title' post_id='".$child->ID."' post_type='child' edit='true' allow_delete='true' label_title='Name' redirect='/?page_id=18&children']";
                echo do_shortcode($shortcode);
            }

    Are there any hooks that can be used to filter the content of the form? Or perhaps a different method to allow multiple forms of the same type on the same page?

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

    Hi Smiffy,

    It's not possible to use more frontend submit forms on a page. A field will have the same ID in other forms so it will submit one value for a field in all forms.

    I think you can use a cloneable field child name (type text) then create posts based on the field value after submitting a form. Please read more on the documentations
    https://docs.metabox.io/extensions/mb-frontend-submission/#form-actions
    https://developer.wordpress.org/reference/functions/wp_insert_post/

    #30716
    Leerpodium
    Participant

    We have similar use cases in which we would like to have multiple forms on the same page.

    One use case for is creating/editing questionnaires (CPT: questionnaire) with multiple questions (CPT: question).

    Cloneable fields will not be an option for us in these cases.

    Would it be possible to think about implementing this feature, for instance by creating unique ids for the different forms, instead of using the meta_box id's to generate the form id?

    We have worked a lot with toolset (toolset forms) and they used to have the same issue... but after some feature requests they made this possible.

    Cheers,

    Tako

    #30720
    Long Nguyen
    Moderator

    Hi,

    Thanks for your feedback.

    The multiple steps form feature for this extension is on our roadmap. Please vote for it here https://trello.com/b/OCOz26GM/meta-boxs-public-roadmap

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