- This topic has 4 replies, 2 voices, and was last updated 5 years, 1 month ago by
randymac.
-
AuthorPosts
-
-
December 11, 2016 at 2:02 am #7644
randymacParticipantI have a conditional tag inside a field group and instead of hiding the individual field, its hiding the entire group. I have been searching the forums and found this post from 2014, does this bug still exists from years ago? Or is it something else? Any help is appreciated.
Here is some of my code, the first two fields are the problem ones, the second is the same but ungrouped and works properly.
piklist('field', array( 'type' => 'group' ,'field' => 'spec_hours' ,'label' => 'Hours' ,'list' => false //,'add_more' => true ,'description' => 'description here' ,'fields' => array( array( 'type' => 'select' ,'field' => 'repeat_select2' ,'label' => __('Repeat', 'piklist-demo') ,'columns' => 2 ,'choices' => array( 'none' => 'None' ,'weekly' => 'Weekly' ,'monthly' => 'Monthly' ,'yearly' => 'Yearly' ) ) ,array( 'type' => 'select' ,'field' => 'repeat_days' ,'label' => __('Days', 'piklist-demo') ,'columns' => 6 ,'list' => false ,'choices' => array( '1' => 'M','2' => 'T','3' => 'W','4' => 'T','5' => 'F','6' => 'S','7' => 'S' ) ,'conditions' => array( array( 'field' => 'spec_hours:repeat_select2' ,'value' => 'weekly' ) ) ) ) ,'on_post_status' => array( 'value' => 'lock' ) )); piklist('field', array( 'type' => 'select' ,'field' => 'repeat_select1' ,'label' => __('Repeat', 'piklist-demo') ,'columns' => 2 ,'choices' => array( 'none' => 'None' ,'weekly' => 'Weekly' ,'monthly' => 'Monthly' ,'yearly' => 'Yearly' ) )); piklist('field', array( 'type' => 'select' ,'field' => 'repeat_days1' ,'label' => __('Days', 'piklist-demo') ,'columns' => 6 ,'list' => false ,'choices' => array( '1' => 'M','2' => 'T','3' => 'W','4' => 'T','5' => 'F','6' => 'S','7' => 'S' ) ,'conditions' => array( array( 'field' => 'repeat_select1' //,'value' => 'spec_hours:weekly' ,'value' => 'weekly' ) ) )); -
December 15, 2016 at 5:37 pm #7657
-
December 17, 2016 at 10:19 am #7671
randymacParticipantHi Steve, thank you for your reply. I have attached a gif of the group disappearing when selecting anything besides weekly in the first field. Its supposed to show or hide the Days field (as the second non group does).
On your second note, I added the
,'field' => 'spec_hours', because without it, the conditional logic does nothing in that group.All of this is inside of a settings page for a wordpress plugin.
Attachments:
You must be logged in to view attached files. -
December 22, 2016 at 11:07 am #7685
SteveKeymasterThis seems to be working for me. Using the code you posted above:
cloudup.com/cnrET-hYg0t
-
December 23, 2016 at 4:25 am #7692
randymacParticipantAre you using the exact code I am? I notice your ‘description here’ is under ‘Hours’, where mine is under the first dropdown.
I’ve done some more trial and error and discovered that I experience this bug with only with ,’on_post_status’ => array( ‘value’ => ‘lock’). I think this line was just a leftover from the sample I started with. That solves my problem, although i still have to have the field set on the group, or the conditional logic does not hide the Days.
Thanks again for trying to help. I hope i f anyone else ends up in situation, this helps them fix it.
-
-
AuthorPosts
- You must be logged in to reply to this topic.