Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
I am not sure if what I see is incorrect behaviour or behaviour that I did not expect..

I followed the extended users guide and implemented all succesfully. Now I have created an extra field on editable template index.php (users) of type "checkbox". The field expresses if the user wants to receive the club's newsletter and is selected by default. But it should be deselectable. If I deselect it and save, it is always switched on again. Is this expected behaviour?

This is my template definition (users/index.php)
Code: Select all
<cms:template clonable='1' title='Users' hidden='1' order='90' >
<!-- If additional fields are required for users, they can be defined here in the usual manner. -->       
   <cms:editable name="newsletter"
            label="Send newsletter"
            type="checkbox"
            opt_values="Club news"
            opt_selected="Club news" />
</cms:template>
"I have never tried that before, so I think I should definitely be able to do that" - Pippi Longstocking

Apologies. I get it now. The value *is* deselected when I deselect and save, just appears as selected all the time due to the default setting.
"I have never tried that before, so I think I should definitely be able to do that" - Pippi Longstocking

just appears as selected all the time due to the default setting.

It shouldn't be so if page was saved with checkbox not-selected. My best guess it's a bug somewhere in CouchCMS.

I am not sure it is a bug. When you deselect the checkbox it appears as deselected (of course) on the screen. When you save, the deselection is stored in the database. When you then re-enter the page, it renders the page with the selection switched on by default - just a you instructed it - even though the setting in the database is different. It's just that the current setting is not visible.

From a user's perspective, this behaviour is not ideal. I would therefore like to propose to add a way to see the current setting in the database for all fields that get a default setting and to which this problem could apply.
"I have never tried that before, so I think I should definitely be able to do that" - Pippi Longstocking
From a user's perspective, this behaviour is not ideal.

'opt_selected' is meant to auto select the specified value when nothing is selected.
In that sense, it is doing what it is supposed to do.

However, I do agree, that when the checkbox consists of only a single value (as in your case), this default behavior can be confusing.

I suggest you please use type 'radio' with explicit two values (Yes/No) instead.
That would be clearer from the user's perspective..

Yes that is a way too. I will implement it that way, thanks KK !
"I have never tried that before, so I think I should definitely be able to do that" - Pippi Longstocking
6 posts Page 1 of 1