Tagged: add_more
- This topic has 4 replies, 2 voices, and was last updated 7 years, 1 month ago by
Steve.
-
AuthorPosts
-
-
December 3, 2014 at 8:09 am #2919
Sander SchatMemberHi!
got a bit of a question here:
i have a group field with “add_more” option.
ONE of the group_fields is a ‘select’ field also with an “add_more” option.I shows up correctly, but when i save it, it messes up the fields.
i post a result screen shot, in where you see messed up fields.
also,
the “+” button on the select_field does not work (when saved)here the code:
piklist( 'field', array( 'type' => 'group', 'label' => 'Blok', 'add_more' => true, 'description' => 'De quiz wordt onderverdeeld in aangemaakte blokken', 'fields' => array( array( 'type' => 'text', 'field' => 'blok_titel', 'label' => 'Blok Titel', 'required' => true, 'columns' => 12 ), array( 'type' => 'textarea', 'field' => 'blok_introtext', 'label' => 'Blok introtext', 'columns' => 12 ), array( 'type' => 'textarea', 'field' => 'blok_outtrotext', 'label' => 'Blok outrotext', 'columns' => 12 ), array( 'type' => 'select', 'add_more' => true, 'field' => 'vraag', 'label' => 'vraag', 'choices' => array( 0 => "Selecteer..." ) + piklist( get_posts( array( 'post_type' => 'qvraag', 'posts_per_page' => '-1', 'orderby' => 'title', 'order' => 'ASC' ), 'objects' ), array( 'ID', 'post_title' ) ), 'columns' => 10 ), array( 'type' => 'file', 'field' => 'blok_image', 'label' => __( 'Image', 'piklist-demo' ), 'options' => array( 'modal_title' => __( 'Add File(s)', 'piklist-demo' ), 'button' => __( 'Add', 'piklist-demo' ) ), 'columns' => 12 ) ) ) );Did i miss some setting somewhere? or can i tweak it a bit?
Please advice. Thanks!
Attachments:
You must be logged in to view attached files. -
December 3, 2014 at 12:02 pm #2927
SteveKeymasterI think this was a combination of errors in Pikist and in your field code.
Try upgrading to v0.9.4.21 and then use this code:
piklist('field', array( 'type' => 'group' ,'label' => __('Blok') ,'field' => 'Blok' ,'add_more' => true ,'fields' => array( array( 'type' => 'text' ,'field' => 'blok_titel' ,'label' => 'Blok Titel' ,'columns' => 12 ,'required' => true ,'attributes' => array( 'class' => 'large-text' ) ) ,array( 'type' => 'textarea' ,'field' => 'blok_introtext' ,'label' => 'Blok introtext' ,'columns' => 12 ,'attributes' => array( 'class' => 'large-text' ) ) ,array( 'type' => 'textarea' ,'field' => 'blok_outtrotext' ,'label' => 'Blok outrotext' ,'columns' => 12 ,'attributes' => array( 'class' => 'large-text' ) ) ,array( 'type' => 'group' ,'field' => 'vraag-group' ,'add_more' => true ,'fields' => array( array( 'type' => 'select' ,'field' => 'vraag' ,'label' => 'vraag' ,'columns' => 12 ,'choices' => array( 0 => "Selecteer..." ) + piklist( get_posts( array( 'post_type' => 'post' ,'posts_per_page' => '-1' ,'orderby' => 'title' ,'order' => 'ASC' ) ,'objects' ) ,array( 'ID' ,'post_title' ) ) ) ) ) ,array( 'type' => 'file' ,'field' => 'blok_image' ,'label' => __( 'Image', 'piklist-demo' ) ,'options' => array( 'modal_title' => __( 'Add File(s)', 'piklist-demo' ) ,'button' => __( 'Add', 'piklist-demo' ) ) ) ) ));I essentially pulled the code from Piklist Demos > Advanced > Content Section (Grouped).
Let me know if that works for you.
-
December 15, 2014 at 10:54 am #3100
Sander SchatMemberHi Steve,
thanks for your reply.
I am back at the ‘site’ and still have problems with this field.
(although i had it working with an older version)I have updated to latest version today,
and have this piece of code<?php /* Title: Blokken Post Type: oquiz Order: 20 */ piklist( 'field', array( 'type' => 'group', 'label' => 'Blok', 'add_more' => true, 'description' => 'De quiz wordt onderverdeeld in aangemaakte blokken', 'fields' => array( array( 'type' => 'text', 'field' => 'blok_titel', 'label' => 'Blok Titel', 'required' => true, 'columns' => 12 ), array( 'type' => 'textarea', 'field' => 'blok_introtext', 'label' => 'Blok introtext', 'columns' => 12 ), array( 'type' => 'textarea', 'field' => 'blok_outrotext', 'label' => 'Blok outrotext', 'columns' => 12 ), array( 'type' => 'group', 'field' => 'blok_vragen', 'add_more' => true, 'fields' => array( array( 'type' => 'select', 'field' => 'vraag', 'label' => 'vraag', 'choices' => get_questions(), 'columns' => 12 ) ) ), array( 'type' => 'file', 'field' => 'blok_image', 'label' => __( 'Image', 'piklist-demo' ), 'options' => array( 'modal_title' => __( 'Add File(s)', 'piklist-demo' ), 'button' => __( 'Add', 'piklist-demo' ) ), 'columns' => 12 ) ) ) );I am not able to save any entry now
When selecting one option from the dropdown,
after save, i have ‘0’ back as defaultAny thoughts?
Suggestions? -
December 15, 2014 at 11:02 am #3102
Sander SchatMemberfound something to get it working!
in the ‘first group’ i had to add a field as well
now it saves correctly
<?php /* Title: Blokken Post Type: oquiz Order: 20 */ piklist( 'field', array( 'type' => 'group', 'field' => 'blok', 'label' => 'Blok', 'add_more' => true, 'description' => 'De quiz wordt onderverdeeld in aangemaakte blokken', 'fields' => array( -
December 15, 2014 at 12:44 pm #3103
SteveKeymasterGreat! Glad it’s working. Closing ticket.
-
-
AuthorPosts
- The topic ‘add_more in add_more’ is closed to new replies.