[SOLVED] Compare lets you change values of disabled fields

Hello,

This may well be deliberate and so not a bug, it is also not too important for us as we can use scripts to enforce the correct data is retained. Came across this issue when a field that we programmatically populate with scripts was accidentally emptied by a user causing our data to be in an invalid state.

I have…

  • [x] Checked the logs and have uploaded a log file and provided a link because I found something suspicious there. Please do not post the log file in the topic because very often something important is missing.

I’m submitting a…

  • [ ] Regression (a behavior that stopped working in a new release)
  • [x] Bug report
  • [ ] Performance issue
  • [ ] Documentation issue or request

Current behavior

Fields that are disabled in the UI can have their values changed by users by using the Compare functionality.

Expected behavior

Fields that are disabled in the UI should not be able to have their values changed by users when using the Compare functionality.

Minimal reproduction of the problem

  1. Create a schema with a field (have confirmed it happens with String, Boolean, Number and DateTime)
  2. Publish it
  3. Create a piece of content for the schema
  4. Update that content so that you have multiple versions
  5. Amend schema to disable the field
  6. View the content again
  • you can no longer update the field
  1. Click ‘Compare’ on the initial version
  2. Click the back arrow button next to the field
  3. Click ‘Save’
  • The disabled field’s content has been updated

Environment

  • [x] Self hosted with docker
  • [ ] Self hosted with IIS
  • [ ] Self hosted with other version
  • [ ] Cloud version

Version: 377fe120d74085bac86607674b244855cab0215b (More stories (#873))

Browser:

  • [x] Chrome (desktop)
  • [ ] Chrome (Android)
  • [ ] Chrome (iOS)
  • [ ] Firefox
  • [ ] Safari (desktop)
  • [ ] Safari (iOS)
  • [ ] IE
  • [ ] Edge

Others:


Mitigation for our scenario is to overwrite new empty value with the old populated value:
if (ctx.oldData.DisabledField.iv != null && ctx.data.DisabledField.iv == null) {
ctx.data.DisabledField.iv = ctx.oldData.DisabledField.iv
replace();
}

Good fix, will be changed asap.

1 Like

This topic was automatically closed after 2 days. New replies are no longer allowed.