[MB Frontend Submission] Multiple IDs in one form, possible?
Support › MB Frontend Submission › [MB Frontend Submission] Multiple IDs in one form, possible?
- This topic has 4 replies, 2 voices, and was last updated 8 years, 5 months ago by
Yasin.
-
AuthorPosts
-
May 11, 2017 at 3:02 PM #5831
Yasin
ParticipantHello
I am trying to create a realestate submission form,
I have some ids like,
estate_indoor_options (multiple_selectbox)
estate_outdoor_options (multiple_selectbox)
estate_comfort_options (multiple_selectbox)
estate_location ( map )If i create multiple forms with multiple shortcodes like
[mb_frontend_form id="estate_indoor_options"]
[mb_frontend_form id="estate_outdoor_options"]
[mb_frontend_form id="estate_comfort_options"]
[mb_frontend_form id="estate_location"]there are 4 submission forms on one page. But i want to the shortcode to render multiple ids in one form. Because if there is 4 forms , each of them needs seperate submission.
Is there a way to make include multiple ids in shortcode?
May 12, 2017 at 9:31 AM #5840Anh Tran
KeymasterWhy do you need 4 meta boxes / forms? Is it just easier to create 1 meta box / form with all the fields? You can use the
heading,dividerfields to keep them separated. Or usecustom_htmlfield to insert custom HTML between them.I think it's better than creating 4 forms (and the shortcode can't handle multiple IDs at the moment).
May 12, 2017 at 5:40 PM #5848Yasin
ParticipantHello
Yes its so simple when they are all in one id but, i am looping a lot of foreach for
RWMB_Core::get_meta_boxes();to get both values and keys in the frontend to make it easy to print fields.Now i am also started to use same foreach to build a submission form and its working without any problem. However i have different issue hope you can guide me.
I have a multiple checkbox field and the values of checkboxes are 1,2,3,4,5,6,7,8,9,10
the meta_key is shown in fields are like this
<input value="1" type="checkbox" size="30" class="rwmb-checkbox_list " name="estate_purpose[]">However when i am inserting post i couldnot find a way to insert estate_purpose[] values.
Here are some tries:
[estate_purpose] => Array ( [0] => 9, //(id) [1] => 10, //(id) )[estate_purpose] => Array ( [9] //(id) => 1, [10]//(id) => 1, )[estate_purpose] => Array ( [9] //(id) => on, [10]//(id) => on, )none of them worked. How can i insert multiple checkbox fields into the post? I mean how the array must be built?
Thanks.
May 13, 2017 at 2:31 PM #5850Anh Tran
KeymasterIf you want to insert values for
checkbox_list, you should insert each value in 1 meta, like this:add_post_meta( $post_id, $key, 1, false ); add_post_meta( $post_id, $key, 2, false );Note to set the last parameter
false. It makes we can insert multiple values in multiple rows for the post.May 13, 2017 at 6:52 PM #5853Yasin
ParticipantThanks for guide, it worked!
-
AuthorPosts
- The topic ‘[MB Frontend Submission] Multiple IDs in one form, possible?’ is closed to new replies.