[SOLVED]: Validation on Action Button Press?

Discuss the Indigo Plugin SDK and developing Indigo plugins here.
autolog
Posts: 4077
Joined: Tue Sep 10, 2013 3:07 am
Location: West Sussex, UK
Contact:

[SOLVED]: Validation on Action Button Press?

Post by autolog »

I have a dialogue that has a number of buttons in an Action ConfigUI (Edit Action Settings...) that I would like to cause validation to happen on other dialogue fields. I can see from the documentation how to do this when the SAVE button is pressed but not on button fields that invoke a callBackMethod.

The callBackMethod is called with (self, valuesDict, typeId, actionId) and just returns the valuesDict.

Is there any way that an errorDict can be passed back from these calls so that fields in error are flagged up in the dialogue?

TIA :)
Last edited by autolog on Mon Nov 03, 2014 6:33 am, edited 1 time in total.
User avatar
matt (support)
Site Admin
Posts: 21542
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

Re: Validation on Action Button Press?

Post by matt (support) »

Hi Jon,

Yes, instead of returning just the valuesDict try returning a tuple of the valuesDict and an errorDict:

Code: Select all

		errorsDict = indigo.Dict()
		errorsDict['someFieldId'] = u"some error on this control occurred"
		return (valuesDict, errorsDict)
Image
autolog
Posts: 4077
Joined: Tue Sep 10, 2013 3:07 am
Location: West Sussex, UK
Contact:

Re: Validation on Action Button Press?

Post by autolog »

Hi Matt,

That works well at the field level - Thanks :D

I have also tried specifying an errorDict["showAlertText"] value but this seems to be ignored.

Is defining this a step too far :?:

At the moment I am using a normally hidden label field to highlight the error but doing this means I have to add in logic to hide it when the error is cleared - a showAlertText would provide a better and more refined solution.
Last edited by autolog on Mon Nov 03, 2014 6:33 am, edited 1 time in total.
User avatar
matt (support)
Site Admin
Posts: 21542
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

Re: Validation on Action Button Press?

Post by matt (support) »

Hi Jon,

We'll have this fixed in the next version (6.0.19), so that errorDict["showAlertText"] can be used from button/field callbacks and not just during validation.
Image
autolog
Posts: 4077
Joined: Tue Sep 10, 2013 3:07 am
Location: West Sussex, UK
Contact:

Re: [SOLVED]: Validation on Action Button Press?

Post by autolog »

Thanks Matt :-)

Presumably this will up the Indigo ServerApiVersion, so that I can specify it as a prerequisite for my plugin :?:
Post Reply

Return to “Plugin SDK and Development”