Device Validation and Error Messages

Posted on
Thu Jul 11, 2019 6:19 am
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Device Validation and Error Messages

This is probably a niche case and extremely pedantic. It may not warrant any action, so bear with me.

Screen Shot 2019-07-11 at 7.12.09 AM.png
Screen Shot 2019-07-11 at 7.12.09 AM.png (13.19 KiB) Viewed 1574 times


I have a device with a group of seven checkbox controls where I am requiring users to select at least two of them. It doesn't matter which two. When returning the error message dict, it doesn't seem like good UX design to highlight all of the controls or all the unselected controls, so instead I plan to highlight the label for the group (an alternative would be to highlight nothing at all and rely solely on the 'showAlertText' dialog). Regardless, the config UI returns the expected "Error validating fields. Hover over the red field labels above to see the error reason." on error.

Screen Shot 2019-07-11 at 7.14.31 AM.png
Screen Shot 2019-07-11 at 7.14.31 AM.png (15.67 KiB) Viewed 1574 times


In this case, the error message isn't technically associated with a field label, or nothing is highlighted red if I go just with the alert dialog. So I would suggest the device config dialog alert message be changed slightly to something like: "Error validating fields. Hover over any red label(s) above to see the error reason." (or something like that), which would be more inclusive of potential conditions within the config dialog.

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

[My Plugins] - [My Forums]

Posted on
Thu Jul 11, 2019 6:31 am
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Device Validation and Error Messages

DaveL17 wrote:
This is probably... ... extremely pedantic.... .

Is that a fault? :lol:

DaveL17 then wrote:
...So I would suggest the device config dialog alert message be changed slightly to something like: "Error validating fields. Hover over any red label(s) above to see the error reason." (or something like that), which would be more inclusive of potential conditions within the config dialog.

No less pedantic, but maybe more broadly applicable, how about the ability to, optionally, provide the text of the error message? Then you could have...
    Error validating fields. A minimum of two options must be selected.

Posted on
Thu Jul 11, 2019 8:42 am
jay (support) offline
Site Admin
User avatar
Posts: 18219
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Device Validation and Error Messages

DaveL17 wrote:
In this case, the error message isn't technically associated with a field label, or nothing is highlighted red if I go just with the alert dialog. So I would suggest the device config dialog alert message be changed slightly to something like: "Error validating fields. Hover over any red label(s) above to see the error reason." (or something like that), which would be more inclusive of potential conditions within the config dialog.


I think a relatively simple change might be to just not show any text there if showAlertText is used (I don't recall if we already do this, but I suspect not). So you could put your full validation error(s) into the alert sheet and the underlying built-in mechanism would just be bypassed. We'll look into that next time we're in the plugin dialog code.

Question: any reason why you're using multiple checkboxes rather than a list? That would be a single control where you can select multiple things but with a single point for validation.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Jul 11, 2019 9:02 am
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Device Validation and Error Messages

berkinet wrote:
Is that a fault? :lol:

If you ask my employer, no.

If you ask my wife, yes. :D

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

[My Plugins] - [My Forums]

Posted on
Thu Jul 11, 2019 9:04 am
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Device Validation and Error Messages

jay (support) wrote:
I think a relatively simple change might be to just not show any text there if showAlertText is used (I don't recall if we already do this, but I suspect not). So you could put your full validation error(s) into the alert sheet and the underlying built-in mechanism would just be bypassed. We'll look into that next time we're in the plugin dialog code..

Thanks Jay. I think that's a great compromise.

EDIT -- I can confirm that the error text still appears when only an alert dialog is used.

Question: any reason why you're using multiple checkboxes rather than a list? That would be a single control where you can select multiple things but with a single point for validation.

My excuse is going to be that I want to pre-select multiple things and in the back of my mind, that isn't possible with a list--but now I'm second-guessing that assumption. I will go back and look again. A list would be more intuitive, I think.

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

[My Plugins] - [My Forums]

Posted on
Thu Jul 11, 2019 9:10 am
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Device Validation and Error Messages

Yep, looks like I was wrong on that. You can indeed have multiple values as the defaultValue. A list it will be.

My suggestion still stands. :D

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

[My Plugins] - [My Forums]

Posted on
Thu Jul 11, 2019 12:25 pm
jay (support) offline
Site Admin
User avatar
Posts: 18219
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Device Validation and Error Messages

Another thing that you can do (I think) is to use a callback such that whenever the list selection changes it will call back to your plugin. You can use that callback to validate how many things are selected and show/hide appropriate label fields. I'm pretty sure the callback works for lists, but I might be misremembering...

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 16 guests