Problems, need help? Have a tip or advice? Post it here.
2 posts Page 1 of 1
Having a strange problem.

- With the following template, tags_2 always saves correctly.
- tags_1 doesn't save, even when showing.
- if i remove tags_2 completely, tags_1 doesn't save.
- if i take the not_active flag off tags_1 it does save its value.


Code: Select all
<?php require_once( 'c/cms.php' ); ?>
<cms:template title="rel test" >
    <cms:editable order='100'
                  type='radio'
                  name='show_select'
                  opt_values='Show=show|Hide=hide'
                  opt_selected='show'
                />
   
    <cms:func _into='show_select' show_select=''>
        <cms:if "<cms:is 'show' in=show_select />">
            show
        <cms:else />
            hide
        </cms:if>
    </cms:func>

    <cms:editable order='200'
                  type='relation'
                  name='tags_1'
                  masterpage='tags.php'
                  not_active=show_select
                />
   
    <cms:editable order='300'
                  type='relation'
                  name='tags_2'
                  masterpage='tags.php'
                />
</cms:template>
<?php COUCH::invoke(); ?>


tags.php:
Code: Select all
<?php require_once( 'c/cms.php' ); ?>
<cms:template title='Tags' clonable='1' hidden='0' parent='content' order='500'>
    <cms:editable
        name='in_frontend'
        label='Show this tag on front end'
        desc='If Yes then this tag will be shown in blog filter, blog titles, etc'
        type='radio'
        opt_values='Yes=1 | No=0'
        opt_selected = '0'
        order='10'
    />
</cms:template>
<?php COUCH::invoke(); ?>


I'm a little stumped at the moment.
Anyone have any ideas?

cheers,
gwil.
Found it!
@trendoman to the rescue again
https://www.couchcms.com/forum/viewtopic.php?f=5&t=11512&p=33995#p33988

to recap:
using the is statement on the radio doesn't work in the internal logic (though appears to on the front-end)
as a radio has a single value.
therefore in the internal relation logic the field was always seen as hidden, so was not saved.
fixed by:
Code: Select all
    <cms:func _into='show_select' show_select=''>
        <cms:if show_select='show' >
            show
        <cms:else />
            hide
        </cms:if>
    </cms:func>
2 posts Page 1 of 1