This topic contains 16 replies, has 5 voices, and was last updated by  Jason 2 years, 9 months ago.

  • Author
    Posts
  • #3982

    skytsunami
    Participant

    Hi Guys,

    I am having a problem/bug with some nested repeater group fields that have conditionals.
    The space for the add_more group always shows even if the conditional is not met, take a look at the images bellow.

    Here is the code, am I doing something wrong?

    piklist('field', array(
    'type' => 'group'
    ,'field' => 'cs_select_module_group'
    ,'label' => __('Your Page Modules')
    ,'add_more' => true
    ,'fields' => array(
    
            /* This will show the initial selection of modules */
    
            array(
            'type' => 'select'
            ,'field' => 'cs_module_select'
            ,'label' => 'Select a Module'
            ,'columns' => 12
            ,'choices' => array(
                    'none' => 'Select a Module to add'
                    ,'module' => 'Simple Module'
                    ,'big_module' => 'Big Module'
                    ,'stats_module' => 'Stats Module'
                    ,'logos_module' => 'Logos Module'
                    ,'grid_module' => 'Grid Module'
                )
            )
    
            /* Conditional for Simple Module */
    
            ,array(
            'type' => 'select'
            ,'field' => 'cs_module_backcolor'
            ,'label' => 'Module back color:'
            ,'columns' => 6
            ,'choices' => array(
                    'white' => 'White'
                    ,'blue' => 'Blue'
                    ,'black' => 'Black'
                    ,'gray' => 'Gray'
                )
            ,'conditions' => array(
                    array(
                        'field' => 'cs_select_module_group:cs_module_select'
                        ,'value' => 'module'
                    ))
            )
    
            ,array(
            'type' => 'select'
            ,'field' => 'cs_module_textcolor'
            ,'label' => 'Module main text color:'
            ,'columns' => 6
            ,'choices' => array(
                'white' => 'White'
                ,'blue' => 'Blue'
                ,'black' => 'Black'
                )
            ,'conditions' => array(
                    array(
                    'field' => 'cs_select_module_group:cs_module_select'
                    ,'value' => 'module'
                    ))
            )
    
            ,array(
            'type' => 'editor'
            ,'field' => 'cs_module_text'
            ,'label' => 'Module text'
            ,'columns' => 12
            ,'options' => array (
                'wpautop' => true
                ,'media_buttons' => false
                ,'tabindex' => ''
                ,'editor_css' => ''
                ,'editor_class' => true
                ,'teeny' => false
                ,'dfw' => false
                ,'tinymce' => true
                ,'quicktags' => true
                )
            ,'conditions' => array(
                    array(
                    'field' => 'cs_select_module_group:cs_module_select'
                    ,'value' => 'module'
                    ))
            )
    
            /* Conditional for Big Module */
    
            ,array(
            'type' => 'select'
            ,'field' => 'cs_bigmodule_backcolor'
            ,'label' => 'Module back color:'
            ,'columns' => 6
            ,'choices' => array(
                'white' => 'White'
                ,'blue' => 'Blue'
                ,'black' => 'Black'
                ,'gray' => 'Gray'
                )
            ,'conditions' => array(
                    array(
                    'field' => 'cs_select_module_group:cs_module_select'
                    ,'value' => 'big_module'
                    ))
            )
    
            ,array(
            'type' => 'select'
            ,'field' => 'cs_bigmodule_textcolor'
            ,'label' => 'Module main text color:'
            ,'columns' => 6
            ,'choices' => array(
                'white' => 'White'
                ,'blue' => 'Blue'
                ,'black' => 'Black'
                )
            ,'conditions' => array(
                    array(
                    'field' => 'cs_select_module_group:cs_module_select'
                    ,'value' => 'big_module'
                    ))
            )
    
            ,array(
            'type' => 'select'
            ,'field' => 'cs_bigmodule_textalign'
            ,'label' => 'Text Alignment:'
            ,'columns' => 12
            ,'choices' => array(
                'right' => 'Right'
                ,'left' => 'Left'
                )
            ,'conditions' => array(
                    array(
                    'field' => 'cs_select_module_group:cs_module_select'
                    ,'value' => 'big_module'
                    ))
            )
    
            ,array(
            'type' => 'editor'
            ,'field' => 'cs_bigmodule_textarea'
            ,'label' => 'Big Module text:'
            ,'columns' => 12
            ,'options' => array (
                'wpautop' => true
                ,'media_buttons' => false
                ,'tabindex' => ''
                ,'editor_css' => ''
                ,'editor_class' => true
                ,'teeny' => false
                ,'dfw' => false
                ,'tinymce' => true
                ,'quicktags' => true
                )
            ,'conditions' => array(
                    array(
                    'field' => 'cs_select_module_group:cs_module_select'
                    ,'value' => 'big_module'
                    ))
            )
    
            ,array(
            'type' => 'file'
            ,'field' => 'cs_bigmodule_img'
            ,'scope' => 'post_meta'
            ,'label' => __('Select an Image (max 1)','piklist')
            ,'columns' => 12
            ,'options' => array(
                'modal_title' => __('Add Image(s)','piklist')
                ,'button' => __('Add','piklist')
                )
            ,'validate' => array(array(
                    'type' => 'limit'
                    ,'options' => array('max' => 1)
                ))
            ,'conditions' => array(
                    array(
                    'field' => 'cs_select_module_group:cs_module_select'
                    ,'value' => 'big_module'
                    ))
            )
    
            /* Conditional for Stats Module */
    
            ,array(
            'type' => 'select'
            ,'field' => 'cs_statsmodule_backcolor'
            ,'label' => 'Module back color:'
            ,'columns' => 6
            ,'choices' => array(
                'white' => 'White'
                ,'blue' => 'Blue'
                ,'black' => 'Black'
                ,'gray' => 'Gray'
                )
            ,'conditions' => array(
                    array(
                        'field' => 'cs_select_module_group:cs_module_select'
                    ,'value' => 'stats_module'
                    ))
            )
    
            ,array(
            'type' => 'select'
            ,'field' => 'cs_statsmodule_textcolor'
            ,'label' => 'Module main text color:'
            ,'columns' => 6
            ,'choices' => array(
                'white' => 'White'
                ,'blue' => 'Blue'
                ,'black' => 'Black'
                )
            ,'conditions' => array(
                    array(
                    'field' => 'cs_select_module_group:cs_module_select'
                    ,'value' => 'stats_module'
                    ))
            )
    
            ,array(
            'type' => 'textarea'
            ,'field' => 'cs_statsmodule_title'
            ,'label' => 'Stats Module title:'
            ,'columns' => 12
            ,'add_more' => true
            ,'attributes' => array('class' => 'large-text', 'rows' => 2)
            ,'validate' => array(array(
                'type' => 'limit'
                ,'options' => array('min' => 4,'max' => 4)
                ))
            ,'conditions' => array(
                    array(
                    'field' => 'cs_select_module_group:cs_module_select'
                    ,'value' => 'stats_module'
                    ))
            )
    
            ,array(
            'type' => 'textarea'
            ,'field' => 'cs_statsmodule_text'
            ,'label' => 'Stats Module text:'
            ,'columns' => 12
            ,'add_more' => true
            ,'attributes' => array('class' => 'large-text', 'rows' => 3)
            ,'validate' => array(array(
                'type' => 'limit'
                ,'options' => array('min' => 4,'max' => 4)
                ))
            ,'conditions' => array(
                    array(
                    'field' => 'cs_select_module_group:cs_module_select'
                    ,'value' => 'stats_module'
                    ))
            )
    
        ) /* End of fields array */
    ));
    
    Attachments:
    You must be logged in to view attached files.
  • #3985

    skytsunami
    Participant

    Looks Like this happens when you set add_more to true on any field that has a conditional set to it.

    Any help would be greatly appreciated.
    Thanks in advance

  • #3987

    Steve
    Keymaster

    @skytsunami– Welcome to the Piklist community!

    Unfortunately, I don’t have a great answer for you right now. You found a new bug, and it will probably take some time to fix.

    You could try breaking out the fields, so you don’t have one giant group field… that may help. In the Piklist Demos, under the Conditions tab, check out the Party Invite meta box. It uses similar conditions, but not in a group field.

    • #3989

      skytsunami
      Participant

      I am doing this way as i am using piklist to create a “Page Builder” where you have a dropdown button with the different blocks available that you can repeat as many times as necessary and that you can then rearrange the order. What is bugging out is when you add another add_more inside of it…

      If there is any other workaround this would be appreciated.

      Thanks in advance

    • #3990

      Steve
      Keymaster

      Did you try breaking those fields out of the group field? Like the Party Invite demo.

    • #3991

      skytsunami
      Participant

      Hi Steve, yes I did but then it does not work the way I want.

      So to resume i want to be able to create a repeater field that I can reorder with its conditional fields if I separate them i will not be able to reorder them. So I am using this logic to create a custom post type page builder where I can add predefined Modules and this way build my page from the admin side of WordPress.

      Wanted to use PikList because not only its awesome its also faster to develop… Hope this gets fixed soon

      Thanks

  • #3992

    Steve
    Keymaster

    Another solution might be Piklist Workflow tabs. Instead of a dropdown with conditions, Your tabs can be: Simple Module, Big Module, Stats Module, Logos Module and Grid Module.

    Once the user clicks on a tab you can present them with a very customized interface. Even more than conditional fields.

    Check out the Piklist Demos to see how we do it, or read this doc.

    So happy you love Piklist! Would you mind telling the world by leaving Piklist a 5 Star review on WordPress.org?

  • #3993

    skytsunami
    Participant

    I had looked into Workflows before posting this topic, it also works great but does not allow me to re-arrange the position of the modules or add more modules.

    About the review I sure will post a review.

  • #3994

    Steve
    Keymaster

    What do you mean “re-arrange the position of the modules or add more modules”?

    • #3996

      skytsunami
      Participant

      I want to be able to add multiple modules on a non specific order, that is why the fields where inside one big group that could be repeated. So you could add multiple “Modules” and because was a add more field you could drag and drop in any order you needed the modules to be, the conditional inside the big group where the fields for each “Module” type that would show and hide depending on the selected option from the dropdown menu.

      To make things more fun some of these “Modules” also need to have repeater fields nested.

      At the moment I am using ACF to archive this configuration.

  • #3997

    Steve
    Keymaster

    Got it…

    We definitely want Piklist to do this. It just may be a while.

  • #3999

    skytsunami
    Participant

    Hope that piklist gets to this level soon, in reality this can be archived as soon as the bug is fixed hopefully in the next release?!? If you need anyone to beta test this let me know as this would be a function that i would use a lot soon its implemented.

    Thanks Steve

  • #4050

    skytsunami
    Participant

    Hi Steve,

    Do we have any timeline to when should this bug be fixed? I would love to keep using piklist fall all projects and start to use it for more advanced things.

    Thanks

  • #4057

    Steve
    Keymaster

    @skytsunami– We are trying to get the next version ready for testing. It may be a few weeks before we can get to this bug.

    I added you to our beta tester list, so you will receive the latest version when it’s ready for testing.

  • #7741

    alexd
    Participant

    hey @skytsunami did you manage to make this work in piklist or did you have to stay on with ACF?

  • #7911

    friendlyfire3
    Participant

    Having this same issue. Need nested fields as I also need the rearrange (drag n drop order) option. However, I also need the show/hide functionality but it’s not working on 0.9.9.12.

  • #8060

    Jason
    Keymaster

    @friendlyfire3 Has this been tested with the latest 0.10 Beta?

You must be logged in to reply to this topic.