AnsweredAssumed Answered

SimpleDialog cancel click propagates too far

Question asked by jpotts Moderator on Jan 5, 2011
I have a need to let workflow task managers edit content with a single click from the task management page in Alfresco 3.4 Community (3.4a, but have reproduced the problem I'm about to describe on 3.4c).

My solution is to add a custom action to the list of actions available on the workflow package items which fires an event. The listener for that event invokes an Alfresco SimpleDialog and calls a custom form definition that includes only the content property. The user can then change the content, click save and close, and complete the workflow task.

Everything described above actually works great, EXCEPT…

If the user clicks Cancel, instead of closing only the SimpleDialog, the dialog closes as well as the task management page. So, if you started on the global dashboard before you managed the workflow task, that's where you'll end up when you click Cancel on my custom dialog, which is very confusing to end users. Interestingly, if the "X" icon is clicked, or if the ESC key is pressed instead of the Cancel button, only the SimpleDialog closes, which is exactly what I want.

Here's a screencast that shows the behavior: http://www.screencast.com/t/jT7DSajw

I can also provide an Ant-deployable Eclipse package that you can deploy to your OOTB Share instance if you want to see it first-hand.

I think what's going on is that a script on the task details page is subscribing to the cancel click event (the task details page also has a Cancel button on it) and is processing it even though the SimpleDialog has already handled it. This explains why the escape KeyListener and the "X" icon clicks don't have the problem–no one on the edit task form is subscribing to those events.

It seems like maybe the SimpleDialog should swallow that cancel event once it is processed instead of letting it bubble up. I've tried adding Event.stopPropagation to my own version of simple-dialog.js but that didn't do the trick.

My work around for now is to hide the cancel button, but obviously, that's short-term. Anyone have any thoughts?

Jeff

Outcomes