Readonly checkbox still editable in device config UI?

Posted on
Tue Oct 09, 2018 5:20 am
autolog offline
Posts: 3991
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Readonly checkbox still editable in device config UI?

I have set a checkbox field to be readonly but I can still modify the check box in the UI?
Code: Select all
            <Field type="checkbox" id="supportsHvacOnOff" readonly="true" defaultValue="false" alwaysUseInDialogHeightCalc="true">
                <Label>TRV Supports ON/OFF:</Label>
                <Description>Set by Plugin depending on TRV model</Description>
            </Field>
Is this a feature or have I missed something?

Posted on
Tue Oct 09, 2018 5:49 am
DaveL17 offline
User avatar
Posts: 6756
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Readonly checkbox still editable in device config UI?

Here too. I tried in both Config.xml and Devices.xml, with the same behavior. I also tried "readonly" vs. "readOnly" and "true", "True" and "YES".

Works as expected with a text field.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Tue Oct 09, 2018 4:54 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Readonly checkbox still editable in device config UI?

Yeah, as I recall (it's been 8 years since we implemented the UI XML) I intentionally didn't allow making a checkbox readonly. I honestly can't remember why exactly - I'll add it to the request list.

In the meantime, you should be able to disable it using an enabled binding to a hidden checkbox that's set to false (yes, the label will also be disabled, but it's as close as you can get at the moment).

[EDIT] Actually, now that I think about it, that's probably the reason. A checkbox with an enabled label to the left but with a disabled checkbox/right label is somewhat confusing IMO...

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Oct 09, 2018 9:34 pm
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: Readonly checkbox still editable in device config UI?

Just for my understanding. For what would you need a read only checkbox?

I understand the value of a hidden checkbox. I use many of them to set other fields visible / hidden

For read only I use text fields where I can show messages, feedback etc.


Sent from my iPhone using Tapatalk

Posted on
Sun Sep 01, 2019 11:57 am
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Readonly checkbox still editable in device config UI?

kw123 wrote:
Just for my understanding. For what would you need a read only checkbox? .

Here is an example (and the reason I found this old thread). I want to have a Menuitem to display a device's properties. In the case I am working on, some properties are set by the user, but others are captured by querying the device. Unlike state, there is no convenient way to view properties. A menu item with a ConfigUI is perfect, it can get and display the data and a checkbox is a good way to display a boolean, especially since that is the hoe the value was set in the first place. However, if the checkbox can actually be operated that implies a semantic that does not exist. I.e. the user may think they have changed the setting, when in fact, nothing happened.
Attachments
Screen Shot 2019-09-01 at 19.55.18.png
Screen Shot 2019-09-01 at 19.55.18.png (118.22 KiB) Viewed 1137 times

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 8 guests