• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC


Forum rules


Only administrators can post or move items here.



Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: [fixed] News: checkboxes (extra fields) do not get unset
PostPosted: Mon Aug 17, 2015 10:24 am 
Offline
New Member
New Member

Joined: Sat Oct 18, 2014 6:39 am
Posts: 3
Hey everyone, can somebody please verify the following:

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.
\$1:
{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} />

Shouldn't that perhaps read
\$1:
{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} />

or something similar? (Sorry, can't highlight in code patterns, it seems. Look at the parameters of 'value' in each row.)

All the best
T


Last edited by olreti on Mon Aug 17, 2015 12:09 pm, edited 1 time in total.

Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: News: checkboxes of extra fields do not get unset
PostPosted: Mon Aug 17, 2015 11:36 am 
Offline
Forum Members
Forum Members

Joined: Tue Oct 21, 2014 12:47 pm
Posts: 103
Location: Lorient (France)
I confirm : an unchecked checkbox is not saved correctly.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: [confirmed] News: checkboxes (extra fields) do not get u
PostPosted: Mon Aug 17, 2015 3:09 pm 
Offline
New Member
New Member

Joined: Sat Oct 18, 2014 6:39 am
Posts: 3
Thanks for confirming.
Unfortunately, my version doesn't work correctly either, now newly set checkboxes are not saved. Does anyone see the correct way? :)


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: [confirmed] News: checkboxes (extra fields) do not get u
PostPosted: Tue Aug 18, 2015 12:53 am 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Tue Oct 19, 2004 6:44 pm
Posts: 8164
Location: Fernie British Columbia, Canada
That was an easy fix (minor change in a template). Fix will be available in the next snapshot.

_________________
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: [fixed] News: checkboxes (extra fields) do not get unset
PostPosted: Tue Aug 18, 2015 8:07 am 
Offline
Forum Members
Forum Members

Joined: Tue Oct 21, 2014 12:47 pm
Posts: 103
Location: Lorient (France)
For me it is OK on snapshot 2015-08-18 00:30


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: [fixed] News: checkboxes (extra fields) do not get unset
PostPosted: Tue Aug 18, 2015 10:38 am 
Offline
New Member
New Member

Joined: Sat Oct 18, 2014 6:39 am
Posts: 3
Can confirm as well, works now.
Thanks, guys.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
A2 Hosting