devdocs icon indicating copy to clipboard operation
devdocs copied to clipboard

Read-only apparently not supported

Open adamlavery opened this issue 3 years ago • 4 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Which topic?

https://devdocs.magento.com/guides/v2.4/pattern-library/getting-user-input/form_elements/form_elements.html#read-only-form-data

What's wrong with the content?

Doc says there should be an option to set a field read-only (as opposed to disabled). But appears this never made it into the actual code. Or it did but was broken at some point and not fixed.

What changes do you propose?

Do UI components actually support a read-only attribute or not? If they do, how is it enabled? If not, remove it from the docs.

Anything else that can help to cover this?

While you're about it, this would be a reasonable place to actually include the relevant XML config that is required for such components, because this information isn't anywhere else.

adamlavery avatar Apr 13 '22 15:04 adamlavery

Hi @adamlavery. Thank you for your report. To speed up processing of this issue, make sure that you provided sufficient information.

Add a comment to assign the issue: @magento I am working on this


m2-assistant[bot] avatar Apr 13 '22 15:04 m2-assistant[bot]

Ok, so there is a way to do it: set elementTmpl to 'ui/form/element/text'. Somehow we're supposed to relate a text component to a read-only element. This doc should state that to create a read-only element, use the Text component, which happens to also be an input component! Cross reference this page to explain it: https://devdocs.magento.com/guides/v2.4/ui_comp_guide/components/ui-text.html

adamlavery avatar Apr 13 '22 15:04 adamlavery

@keharper the purpose of this topic is to describe Admin Design Pattern Library: Getting User Input - Form Elements. This topic does not intend to guide how to implement the feature. So, we don't need to modify this page and this issue should be closed, isn't it?

TuVanDev avatar May 07 '22 04:05 TuVanDev

@Viper9x does what the doc describes work? Regardless of what it's meant to show - if what it describes doesn't actually work then there should be a note like "This is what should be available but it doesn't work so here's how to actually do it...".

adamlavery avatar May 09 '22 08:05 adamlavery