Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

[SOLVED] Bug? Disabled checkboxes loosing value


Go to End


3 Posts   985 Views

Avatar
Bereusei

Community Member, 96 Posts

25 January 2014 at 12:48am

Hey guys,

I checked this phenomenon on serveral Silverstripe 3.1. websites, but want to be sure, that it´s really a bug from silverstripe.

If I have a checked disabled checkbox

 
<input id="Form_ItemEditForm_Categories_27" class="checkbox" name="Categories[27]" type="checkbox" value="27" checked="checked" disabled="disabled"> 

in the backend/modeladmin and I save the entry, the checkbox loose the value, in other word it´s "check".

Can anyone check this phenomenon at his own framework? I could generate this error simple with the google-webdeveloper tool by adding disabled="disabled" into <input>

Avatar
kinglozzer

Community Member, 187 Posts

25 January 2014 at 4:05am

Hi Bereusei,

Default browser behaviour is to not include disabled fields in POST data, so that's what's causing this. If you need to use disabled form inputs in the CMS, the best way to do it is to include some custom JavaScript to re-enable the field on form submit.

Avatar
Bereusei

Community Member, 96 Posts

25 January 2014 at 5:57am

Thanks for the info, kinglozzer. Doesn't make any sense for me why browsers don't do this, but ok. I found a workaround for my problem. Thanks for the help.