If I add an extra field of type "checkbox" to the news module and modify the article, the new value (1) is saved correctly if the checkbox had previously been unselected.
But if I edit it again and I remove the check, it is back to being checked after submitting the form.
Expected behaviour, of course, being that it unsets.
This appears to be related to these lines in news/templates/editarticle.tpl, where (to my understanding) a hidden entry of the same name as the checkbox is used to always include it in $POST, as browsers normally only send it if it's true.
Code: Select all
{elseif $field->type == 'checkbox'}
<input type="hidden" name="{$field->nameattr}" value="{$field->value}" />
<input type="checkbox" id="{$field->idattr}" name="{$field->nameattr}" value="1"{if $field->value == 1} checked="checked"{/if} />
Code: Select all
{elseif $field->type == 'checkbox'}
<input type="hidden" name="{$field->nameattr}" value="false" />
<input type="checkbox" id="{$field->idattr}" name="{$field->nameattr}" value="{$field->value}"{if $field->value == 1} checked="checked"{/if} />
All the best
T