Creating on-change microflow attribute in custom widget

I've succesfully create my first custom widget. Now i want to add an onchange microflow attribute to the widget. Calling a microflow is explained in the documentation , but how can I trigger the microflow during onchange?
5 answers

You can receive changes by connecting a function to the 'onchange' event.

this.connect(this.myNode, "onchange", dojo.hitch(this, this.EventOnChange)));

In case of a textbox this sends changes for every keypress and unless you want to execute the microflow on each on of those, it is better to use the 'onblur' event.

this.connect(this.myNode, "onblur", dojo.hitch(this, this.eventInputBlur)));
this.connect(this.myNode, "onfocus", dojo.hitch(this, this.eventInputFocus)));

For more information about events you can check out this basic article at w3schools or this article about the same events in dojo.

Don't forget to upload it to the App Store if you want others to be able to use it. This is also a great way to get a review of your code and might help you write better widgets or modules. We make sure that every time we need to decline an App, we send an extensive e-mail explaining what needs be improved and how, both about your code as well as your documentation/xml. So don't be afraid to upload it when you feel it is ready to be critiqued ;).


The post data you posted does NOT belong to the mx.processor.xasAction invocation, since it is a 'change' action and not an 'executeation'. So the data you are looking at is triggered by either another widget or by a change performed by you, but it is not triggered by the onChange function.

This is what mx.process.xasaction POST looks like:


A problem might be that your function is named onChange, i would not be surprised if that function is called automatically by the client, so you should use a less general name.


So far, we've been able to trigger a microflow while during onchange. We've tried to show a message with the attribute name. The message triggers but we've not been able to pass the name of a attribute in a show message activity: Date has been changed for organization {1}. {1} is connected to $organization/name. " Date has been changed for organization null" is what we get. I think there is some issue with the context.


You should be able to see in firebug which guids are passed along with the action. You need to pass them explicitly when invoking the action, for example (myguid should be a long value):

//skipped properties
 applyto     : 'selection',
 guids       : [myguid]

I've used your example to change the onchange function:

    error       : function() {
        logger.error( + "error: XAS error executing microflow");
    actionname  : this.onchangeMicroflow,
    guids       : [this.dataobject.getGUID()]

Unfortunately, this is not working. Results in Firebug #change post:



    Object { 281487861612546=Object}

Results in Firebug #change antwoord: