enforce_const doesn't work with setValue
General information
- json-editor version: 2.15.1
Expected behavior
A control is initially created without any data but with 'enforce_const' flag to 'true'. The fields that have the 'constant' attribute in their scheme should be locked for editing. They should remain locked regardless of other user interactions.
Actual behavior
While the 'constant' fields behave as expected when the control is first created (they are locked for editing), they become editable once the method editor.setValue() is triggered programmatically, using any input JSON. This should not happen, they should remain locked for editing regardless of data input.
Steps to reproduce the behavior
- Create a control without startval with enforce_const:true. Verify that all fields with the constant sign in the schema are blocked for editing.
- Call the editor.setValue() method programmatically and pass any json.
- Note, all the fields which were blocked are now available for editing.
We're looking into that ... I agree with your point when you set the correct value. But ... what should happen, when you set the wrong value (eg. const: 5, setValue(8))?