Expand my Community achievements bar.

SOLVED

SwfConnector/formSubmitDataRequest: Which route was clicked?

Avatar

Level 2

Good afternoon,

Setup is: LiveCycle ES2, Flex3 form application.

The use-case boils down to having more than one action/route available at any given moment, i.e. visible and enabled. Given that there is more than a single action possible at any given time, when running the callback to FORM_SUBMIT_DATA_REQUEST occurs the first "task" is to find out which button was clicked on.

The stub code for the above use-case is illustrated below:

private function form_onSubmitDataListener( event: Event ) : void
{
     var route : String = ???
     
     if ( form_isValid( route ) == false )
          return;
     
     var data : XML = form_dataEmit( route );
     lcConnector.setSubmitData( data );
}

Unfortunately, this functionality seems to be glaringly missing given that:

  • event.target references SwfConnector, which has no properties saying on which button was clicked;
  • event.currentTarget also references SwfConnector;
  • The event object is actually an instance of the Event class, which can be confirmed by using describeType().

Even the documentation on this matter is conflicting: with regards to the callback in question, the document"Creating Flex Applications Enabled for
LiveCycle Workspace ES2" isn't clear:

  • Page 26 states that "Configure the function to return void and take a parameter of type DataEvent.";
  • Page 28: "private function HandleSubmitFormDataRequestListener(event:Event):void{"

So how exactly are we supposed to implement *workflow* processes if the end users are restricted, at any given moment, to clicking on a single button?

I must be very clear that the form *must* have more than a single  action available: relying on hacks such as hiding and/or disabling  buttons according to the current form state is exactly that: a hack. As  an example, consider that the form only displays data (ie, the user is  not allowed to change any of it) and just requests the users decision:  Approve, Reject.

Additionally, adding a  ComboBox/RadioButtonGroup to the flex form to contain that decision and  having a single "Complete" button is ludicrous: it renders the  out-of-the-box audit trail useless, it builds the decisions into the  form and not to the process where they should belong. So this too is a  hack!

Or am I missing some fineprint altogether?

Best regards,

1 Accepted Solution

Avatar

Correct answer by
Level 10

I've never tried it but let's try something.

Use the following method's signature: private function form_onSubmitDataListener (event:SwfDataEvent):void

Then you should be able to use event.task.selectedRoute

Jasmin

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

I've never tried it but let's try something.

Use the following method's signature: private function form_onSubmitDataListener (event:SwfDataEvent):void

Then you should be able to use event.task.selectedRoute

Jasmin

Avatar

Level 2

Hey there,

Coercing the event to SwfDataEvent is pointless since the event that we receive from the UITask application is just a plain Event. Having said that, your post was extremely useful in pointing out that the Task class has a selectedRoute property. Since the UITask application binds to the Task class then if we keep a reference to the Task object we can access it once its value is modified!

I confirmed that the following solution does indeed work:

private function form_onSetWorkspaceData( event: SwfDataEvent ) : void
{
    lcConnector.task = event.task;
}

private function form_onSubmitDataListener( event: Event ) : void
{
    var route : String = lcConnector.task.selectedRoute;
    
    if ( form_isValid( route ) == false )
        return;
    
    var data : XML = form_dataEmit( route );
    lcConnector.setSubmitData( data );
}

Thanks!

Best regards,

Message was edited by: Filipe Toscano | Setting question as answered.

Avatar

Level 1

Can you help me? I am working in workbench and i want to get route button which is in workbench clicked. The application as Flash are imported in workbench. If you clicked button in workbench you will get route button which is clicked.

Thanks!