cannot save record - "field is read only" #5312
Replies: 2 comments 4 replies
-
I transfer this question to discussion. |
Beta Was this translation helpful? Give feedback.
-
Hi @teafmartins , I don't completely follow your use case :-) What is the goal? Allow the discount value to be changed or not? If it should be changeable (be it in GUI or background service), then the field within xyzRow.cs should not be declared as updateable(false) IMHO - because it in fact IS updateable. If you want to update the discount field within the "standard" xyzRepository.cs onBeforeSave method, then you also cannot set the [readonly] attribute within xyzForm.cs (as otherwise you get the same alert). In such cases, set the field programmatically to "readonly" within the xyzDialog.cs by using: Serenity.EditorUtils.setReadOnly(this.form.<discountFieldName>, true); within afterLoadEntity method. Ten it will behave everywhere as a read-writeable field - except within the dialog. Hope this helps. With kind regards, John |
Beta Was this translation helpful? Give feedback.
-
Hello,
I have background sevices that update discount field in order database table.
Field "Discount" in Row.cs is defined as "Updatable(false)", but when I save an order tha has changed discount field I get message "discount field is read only".
Is this a bug? shoudn't serenity bypass update of "discount" field?
Thanks for you help.
Beta Was this translation helpful? Give feedback.
All reactions