Skip to content

Commit

Permalink
Read-only is not working in file-attachment
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavitra Khatri committed Apr 22, 2024
1 parent 7851278 commit 208825c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Expand Up @@ -86,6 +86,17 @@
return this.element.querySelector(FileInputV2.selectors.attachButtonLabel);
}

updateReadOnly(readonly) {
let widget = this.widget;
if (readonly === true || this._model.enabled === false) {
widget.setAttribute("readonly", "readonly");
widget.setAttribute(FormView.Constants.HTML_ATTRS.DISABLED, "disabled");
} else {
widget.removeAttribute(FormView.Constants.HTML_ATTRS.DISABLED);
widget.removeAttribute("aria-readonly");
}
}

updateValue(value) {
if (this.widgetObject == null) {
this.widgetObject = new FileInputWidget(this.widgetFields);
Expand Down
2 changes: 1 addition & 1 deletion ui.frontend/src/view/FormFieldBase.js
Expand Up @@ -256,8 +256,8 @@ class FormFieldBase extends FormField {
this.updateValue(state.value);
}
this.updateVisible(state.visible)
this.updateReadOnly(state.readOnly)
this.updateEnabled(state.enabled, state)
this.updateReadOnly(state.readOnly)
this.initializeHelpContent(state);
}

Expand Down

0 comments on commit 208825c

Please sign in to comment.