- This topic has 9 replies, 2 voices, and was last updated 6 years, 11 months ago by
Steve.
-
AuthorPosts
-
-
January 23, 2015 at 11:12 am #3205
jmayhakMemberI believe the following code should work based on https://piklist.com/user-guide/docs/field-parameters/conditions/
However, everything is being hidden on page load. The entire group.
I’m using Piklist 0.9.5h
piklist('field', array( 'type' => 'group', 'scope' => '', 'field' => '_cn_slider', 'columns' => 12, 'add_more' => true, 'fields' => array( array( 'type' => 'text', 'label' => 'Title', 'field' => 'title', 'columns' => 12 ), array( 'type' => 'textarea', 'label' => 'Excerpt', 'field' => 'excerpt', 'columns' => 12, 'attributes' => array( 'rows' => 6, 'cols' => 12 ) ), array( 'type' => 'text', 'field' => 'link', 'label' => 'Link', 'description' => 'eg. http://google.com', 'columns' => 12 ), array( 'type' => 'select', 'field' => 'is_image_or_video', 'label' => 'Media Type', 'choices' => array( 'image' => 'Image', 'video' => 'Video' ) ), array( 'type' => 'file', 'field' => 'image_attachment_id', 'label' => 'Add Image', 'conditions' => array( array( 'type' => 'toggle', 'field' => '_cn_slider:is_image_or_video', 'value' => 'image' ) ) ), array( 'type' => 'text', 'label' => 'Link to Video', 'field' => 'video_src', 'conditions' => array( array( 'type' => 'toggle', 'field' => '_cn_slider:is_image_or_video', 'value' => 'video' ) ) ) ) )); -
January 23, 2015 at 1:52 pm #3206
SteveKeymasterYou can’t set the scope to empty. Remove the entire parameter and let Piklist set it.
-
January 23, 2015 at 3:36 pm #3207
jmayhakMemberwhoops. I was experimenting with the scope property. If I remove it the same things happens.
-
January 23, 2015 at 5:30 pm #3209
-
January 26, 2015 at 12:08 pm #3215
jmayhakMembergot it.
Doesn’t seem to be working with the 0.9.5m version either.
-
January 26, 2015 at 12:20 pm #3217
-
March 9, 2015 at 4:17 pm #3406
jmayhakMemberI noticed that the above code works in a meta-box for a post but does not work for settings. Could there be a bug when using conditions in a grouped field in the settings area?
On line 140 of /parts/js/piklist.js is where everything is hidden (I can see the form but all the inputs are marked hidden). It’s like the toggle functionality is getting triggered on page load.
This is the function process_fields of the class PiklistFields
-
March 10, 2015 at 9:52 am #3414
-
March 10, 2015 at 9:57 am #3415
jmayhakMemberSolved! I was using 0.9.4.25. 0.9.5u solved the problem.
-
March 10, 2015 at 10:06 am #3419
SteveKeymasterGreat! Closing ticket.
-
-
AuthorPosts
- The topic ‘Conditions used in a Grouped Field Issue’ is closed to new replies.