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.

General Questions /

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

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

[SOLVED] Bug? Disabled checkboxes loosing value


Reply


3 Posts   281 Views

Avatar
Bereusei

Community Member, 94 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, 172 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, 94 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.