Validation Before Dialog Closed [solved]
Posted: Wed Feb 14, 2018 5:16 pm
I have a device dialog with a list element where the user can make selections and press a button to add an item to the list.
I want to validate the action (device not already in the list, etc.) but placing the validation code and returning an errorDict within the button callback doesn't seem to work. So instead I call validateDeviceConfigUi from within the button callback and do something like:
So if the validation returns false, then a is False and will throw the log message.
Is there a more straightforward way to do validation within a callback, or is this my best bet?
I want to validate the action (device not already in the list, etc.) but placing the validation code and returning an errorDict within the button callback doesn't seem to work. So instead I call validateDeviceConfigUi from within the button callback and do something like:
- Code: Select all
a, b, c = self.validateDeviceConfigUi(valuesDict, typeId, devId)
if not a:
indigo.server.log(u"Error adding device.")
So if the validation returns false, then a is False and will throw the log message.
Is there a more straightforward way to do validation within a callback, or is this my best bet?