Important announcements from CouchCMS team
55 posts Page 6 of 6
Previous 1, 2, 3, 4, 5, 6 Next
It might not be obvious, but here is a tip for working with conditional fields, where the amount of values in selectors is overwhelming (like, more than 5).

Code: Select all
<cms:func _into='my_cond' long_tiresome_list_of_values=''>
    <cms:if long_tiresome_list_of_values > '=' >show<cms:else />hide</cms:if>
</cms:func>


Above code will show dependant if any selected value in long...list selector starts with a letter. And will hide it otherwise i.e. if it starts with a digit. This trick makes possible to show input on "KX-1209" and hide input on "2842" in the same list. It would be crazy to code all 12765 values in one func separately :lol:

A similar rule may be applied to individual letters: < 'x' will show everything that has as the first symbol a number or A to Z and a to w and will hide x, z and y (case-sensitive). Capital letters are separated with ^ from lowercase ones. For any specific rule, ask here or just review your codepage table.
Is there any way to code k_page_name (or similar) as a controller field? What I'm looking to do is not overwhelm users with choices until the basic page (title, text, image) has been saved into a page.

Once the page with the basic information is saved k_page_name, etc variables are created and those text fields and other vars are no longer empty.

User example: User/Admin clicks "Add New" to create a page. She should only see the basics - title, name, folder - then my user editable text, image. Once all of that has been saved (and the page reloads upon saving) then my "Display Options" group shows up with all the user choices on how to display this page's info into different mods for the site.

What I was hoping that I could use if not empty k_page_name as a controlling function, but that's not working. I'm at a loss on how to use the system vars as a controller. Is this possible?
@scratz

Perhaps the following would help?
viewtopic.php?f=8&t=13527

For your case, you can try using the following code within <cms:config_form_view> block to skip certain fields while the page is still new -
Code: Select all
<cms:jit_fields>
    <cms:if k_page_id eq '-1'>
        <cms:field 'my_field_a' skip='1' />
        <cms:field 'my_field_b' skip='1' />   
    </cms:if>
</cms:jit_fields>

Do let me know if it helped.
@KK,

I can't help but note the timing of your post. If you created this tag to solve my issue, I am truly humbled that you would take the time for such a drastic solution. I'm very happy that it has helpful cases beyond what I need.

The jit_fields tag works for me in this case, thank you. However, the skip='1' param didn't work so I used the following code:
Code: Select all
<cms:config_form_view>
    <cms:field 'display_opts' hide='1' />

    <cms:jit_fields>
        <cms:if k_page_id ne '-1'>
            <cms:field 'display_opts' />
        </cms:if>
    </cms:jit_fields>
</cms:config_form_view>


The reason skip didn't work is because that field 'display_opts' is type='group' which holds all contextual options for the user to choose how they want the page displayed. When 'skip' is used, only the group field is hidden and all of the options inside the group still show up. However, when I 'hide' under 'new/create' view, but display when k_page_id ne '-1', everything displays as intended.
(the hide param is explained in the post KK mentioned - viewtopic.php?f=5&t=10241 under Customizing the Form screen)
Thank you again KK and amazing team for your incredible determination to make CouchCMS the absolute best CMS system out there!
You are welcome @scratz and thanks for the feedback :)
Previous 1, 2, 3, 4, 5, 6 Next
55 posts Page 6 of 6
cron