Forum Discussion

angela's avatar
angela
Catalyst II
1 year ago

How to disable / enable an item selector when property itself is disabled in the (classic) Form editor?

Hi community,

I have an item selector that is disabled by default in an I12 Form. The value for the item property is set by Method most of the time.
Now there is one special use case were I want to allow users to choose the item manually. In this case I want to enable the item selector with an onLoad event. 

I right now use the code sample of following blog article for disabling/enabling the selector: https://aras.com/en/blog/disable-form-fields
The code still works fine, but only when the "item property" is NOT disabled in the Form from the start. 

This image shows the situation with two item selectors. The left one is disabled in the Form, the right one enabled. For both selectors I use the code from the blog article to enable the selecotors:

Does anyone know how to enable the item selector when it was completely disabled in the Form?

I assume the current solution needs the item selector button and the item box to be visible. 
I would be prefer a solution where the item selector is either enabled - OR completely hidden. I want to avoid a "greyed-out" selector cause people still would assume they can use it somehow.

Thanks for any help!

Angela

1 Reply

  • Anonymous's avatar
    Anonymous
    Approved

    Couldn't you use the function

    field.style.visibility = "hidden";

    in the same logic in that you enable/disable the field?