Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
Opening an new post from
https://www.couchcms.com/forum/viewtopic.php?f=5&t=11512&p=39728&hilit=mosaic+group#p39728
Admittedly, I did not follow up with your request on this post because I thought that since you weren't able to replicate the issue, it must be something on my end. However, the same site I gave you access to recently also has this problem, so I can easily point out where if the code below isn't sufficient.

PROBLEM: I'm finding there to be inconsistent behavior with conditionally configured type='groups' showing and hiding when conditions are met, but only when in mosaics and only groups.

I looked at this
Code: Select all
https://www.couchcms.com/forum/viewtopic.php?f=4&t=13621
and downloaded that updated function.php in case there may have been a solution in this new code, but that didn't help, either.

The basic problem is that in a mosaic, I cannot get 'groups' to show/hide consistently. To be sure, I change the editable from 'group' to 'row' and everything works correctly. Whenever I change the respective editable back group, sometimes it will show, sometimes it won't, sometimes it works after I save the tile and re-edit depending on the show/hide settings. But for the most part, groups don't respond correctly to the conditional condition, if they respond at all.

I don't have this issue with groups not built in a mosaic and I don't have this problem with any other editable (rows, editables, repeatables inside mosaics. I'm only finding the behavior with type='groups' inside mosaics. I have copy/pasted the exact same code to regular templates (not in mosaics) to be sure and the groups respond as configured.


QUICK SUMMARY: I can build conditional type='groups' to show/hide in a regular clonable or non-clonable template and they will work correctly. I can copy/paste that same code into a template inside a mosaic (changing the names and verifying the order is correct) and the groups do now show/hide as expected. Once I change 'group' to 'row' inside the mosaic, the 'row' will show/hide as directed by the conditional.

Here is my mosaic code:
Code: Select all
<?php require_once( '../comm_admin/cms.php' ); ?>
<cms:template title='Page Hero Catalog' parent='_mods_' icon='cog' clonable='0'  order='1000' >
    <cms:mosaic name='hero_block_msc' label='Hero Block' body_class='_pb'>
        <cms:tile name='hero_clr_tile' label='Hero Color Background' _pb_template='hero/theme/hero_color' _pb_height='350'>
             <cms:embed 'pb_mods/hero/embed/hero_format.htm' />
             <cms:embed 'pb_mods/hero/embed/hero_txtblk_txt.htm' />
        </cms:tile>
    </cms:mosaic>
</cms:template> 
<?php COUCH::invoke(); ?>


Here is my conditional code:
Code: Select all
 <cms:editable type='dropdown' name='hero_txtbx_opt' label='Header Text' desc=''
        opt_values='Text=0|Image=1|Form=2'
        class='col-md-2'
        order='117'
    />
<cms:func _into='hero_txtblk_txt_chc' hero_txtblk_blk_opt=''>
    <cms:if hero_txtblk_blk_opt="0" >
        show
    <cms:else />
        hide
    </cms:if>
</cms:func>   
<cms:func _into='hero_txtblk_img_chc' hero_txtblk_blk_opt=''>
    <cms:if hero_txtblk_blk_opt="1" >
        show
    <cms:else />
        hide
    </cms:if>
</cms:func>
<cms:func _into='hero_txtblk_form_chc' hero_txtblk_blk_opt=''>
    <cms:if hero_txtblk_blk_opt="2" >
        show
    <cms:else />
        hide
    </cms:if>
</cms:func>

here is the conditionals (amended for brevity):
Code: Select all
<cms:editable type='group' name='hero_txtblk_text_grp' label='Input Text For Hero' not_active=hero_txtblk_txt_chc order='302'>
    <cms:repeatable name='hero_txtbx_txt_rpt' label='Header Text Lines - New Row = New Line' stacked_layout='1' order='305' >
        <cms:editable type='text' name='herotxt_ln' label='Text'
            order='307'
        />
   
    </cms:repeatable>
</cms:editable>

<cms:editable type='group' name='hero_txtblk_img_grp' label='Input Text For Hero' not_active=hero_txtblk_img_chc order='375'>
    <cms:editable type='image' name='hero_txtblk_img' label='Upload Image for Text' desc='1:1 ratio max h or w will be enforced at 500px'
        width='500'
        height='500'
        enforce_max='1'
        show_preview='1'
        preview_width='75'
        not_active=hero_txtbx_img_chc
        order='378'
    />
    <cms:editable type='text' name='hero_txtblk_img_alt' label='Text Image Alt Description' desc='for screen readers' not_active=hero_txtbx_img_chc order='380'  />
</cms:editable>


<cms:editable type='group' name='hero_txtblk_form_grp' label='Input Text For Hero' not_active=hero_txtblk_form_chc order='502'>
    <cms:editable type="text" name="hero_txtblk_text_title" label="Form Title" desc="form subject"
        order='504'
    />
    <cms:editable type="text" name="hero_txtblk_form_para" label="Form Byline" desc="" order='508' />
    <cms:editable type='dropdown' name='hdr_frm_ttl_txt_clr' label='Form Title Color'
        opt_values='dropdowns/colors.htm'
        dynamic='opt_values'
        order='510' 
    />
</cms:editable>



All 3 of these will show/hide correctly when the editable is 'row' but when it's 'group', they do not show at all.

Does anyone else have this issue with groups inside mosaics? Is this perhaps a bug?
@scratz, it was indeed a bug.
I have pushed the fix to GitHub.

Thanks for the heads-up and your assistance in sorting out this issue.
This is great, KK, thank you. My groups are now showing inside mosaics from either checkbox or dropdown controllers.

Doing further testing, I'm seeing that it doesn't appear that I can do conditional formatting inside a group that is activated by conditional formatting

When my code is like this, the group now shows up (thank you!), but the condition inside this group isn't responsive:
Code: Select all
<cms:editable type='group' name='hero_bg_clr_grp' collapsed='1' label='Background Custom Color' not_active=hero_bg_clr_cust_chc order='910' >
    <cms:editable type='row' name='hero_bg_clr_row' label='Solid Color or Gradient'  order='912'>
        <cms:editable type='dropdown' name='hero_bg_clr_grdt_opt' label='Solid or Gradient Color' desc=''
            opt_values='Solid=0|Gradient=1'
            class='col-md-6' 
            order='914'
        />
        <cms:func _into='hero_bg_clr_grdt_chc' hero_bg_clr_grdt_opt=''>
            <cms:if hero_bg_clr_grdt_opt="1" >
                show
            <cms:else />
                hide
            </cms:if>
        </cms:func>   
    </cms:editable>
    <cms:editable type='checkbox' name='hero_bg_clr_grdt_rvrs_opt' label='Reverse Background Gradient Colors'
        opt_values='Swap=1'
        class='col-md-6'
        not_active=hero_bg_clr_grdt_chc 
        order='919'
    />
</cms:editable>
<cms:editable type='group' name='hero_ovrly_grp' collapsed='1' label='Color Overlay' not_active=hero_bg_ovrly_cust_chc order='930' >
    <cms:editable name='hero_ovrly_row' type='row' order='935'>
        <cms:editable type='dropdown' name='hero_ovrly_clr_grdt_opt' label='Image Overlay' desc=''
            opt_values='Solid=2|Gradient=1'
            class='col-md-6' 
            order='936'
        />
        <cms:func _into='hero_bg_clr_grdt_chc' hero_ovrly_clr_grdt_opt=''>
            <cms:if hero_ovrly_clr_grdt_opt="1" >
                show
            <cms:else />
                hide
            </cms:if>
        </cms:func>   
    </cms:editable>
    <cms:editable type='checkbox' name='hero_ovrly_rvrs_grad' label='Reverse Overlay Gradient Colors'
        opt_values='Swap=1'
        class='col-md-6'
        not_active=hero_bg_clr_grdt_chc 
        order='948'
    />
</cms:editable>


When the code is set inside groups without not_active condition, the condition works correctly
Code: Select all
<cms:editable type='group' name='hero_bg_clr_grp' collapsed='1' label='Background Custom Color' order='910' >
    <cms:editable type='row' name='hero_bg_clr_row' label='Solid Color or Gradient'  order='912'>
        <cms:editable type='dropdown' name='hero_bg_clr_grdt_opt' label='Solid or Gradient Color' desc=''
            opt_values='Solid=0|Gradient=1'
            class='col-md-6' 
            order='914'
        />
        <cms:func _into='hero_bg_clr_grdt_chc' hero_bg_clr_grdt_opt=''>
            <cms:if hero_bg_clr_grdt_opt="1" >
                show
            <cms:else />
                hide
            </cms:if>
        </cms:func>
    </cms:editable>
    <cms:editable type='checkbox' name='hero_bg_clr_grdt_rvrs_opt' label='Reverse Background Gradient Colors'
        opt_values='Swap=1'
        class='col-md-6'
        not_active=hero_bg_clr_grdt_chc 
        order='919'
    />
</cms:editable>
<cms:editable type='group' name='hero_ovrly_grp' collapsed='1' label='Color Overlay'  order='930' >
    <cms:editable name='hero_ovrly_row' type='row' order='935'>
        <cms:editable type='dropdown' name='hero_ovrly_clr_grdt_opt' label='Image Overlay' desc=''
            opt_values='Solid=2|Gradient=1'
            class='col-md-6' 
            order='936'
        />
        <cms:func _into='hero_bg_clr_grdt_chc' hero_ovrly_clr_grdt_opt=''>
            <cms:if hero_ovrly_clr_grdt_opt="1" >
                show
            <cms:else />
                hide
            </cms:if>
        </cms:func>   
    </cms:editable>
    <cms:editable type='checkbox' name='hero_ovrly_rvrs_grad' label='Reverse Overlay Gradient Colors'
        opt_values='Swap=1'
        class='col-md-6'
        not_active=hero_bg_clr_grdt_chc 
        order='948'
    />
</cms:editable>
@scratz,

Thanks again for the heads-up.
I have pushed yet again a new commit to GitHub that should solve this issue.

Please try it out and let me know if it helps.

Thanks.
Hello KK,

I went on github and copied the files to my installation. The code I have above is now working correctly.
I have conditionally activated groups that have conditional controllers and dependents in them that respond exactly as they should.

Thank you for your looking into this so quickly. Take good care of yourself.
Thanks for the feedback, @scratz.
I am glad the fix helped.
6 posts Page 1 of 1