Multiple forms of same type on same page
Support › MB Frontend Submission › Multiple forms of same type on same page
- This topic has 3 replies, 3 voices, and was last updated 4 years, 2 months ago by
Long Nguyen.
-
AuthorPosts
-
July 6, 2021 at 1:08 AM #29315
Smiffy
ParticipantMy 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?
July 6, 2021 at 9:12 AM #29324Long Nguyen
ModeratorHi 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/September 12, 2021 at 9:54 PM #30716Leerpodium
ParticipantWe 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
September 13, 2021 at 10:11 AM #30720Long Nguyen
ModeratorHi,
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
-
AuthorPosts
- You must be logged in to reply to this topic.