Video Screencast Help
Symantec Appoints Michael A. Brown CEO. Learn more.
Endpoint Management Community Blog

Forcing a postback in workflow to deal with an editable datagrid

Created: 28 Mar 2011 • 1 comment
dfnkt_'s picture
+3 3 Votes
Login to vote

Anyone who has ever allowed the grid component in Workflow Solution to be editable can tell you this: It has to do a postback before you write changes to the database. The postback happens on the value of the form changing which is fired when you leave the grid control. 

Do you know what happens when you don't click out of the grid control to fire the postback and click Save / Update / Commit or whatever you named your button? Your last change goes the way of the dodo bird, gone forever (in my experience).

To combat this you can make use of some *sigh* javascript *sigh*. The default name for a form builder page in Workflow seems to be 'form1'. You can verify this by opening said form in production or debug and viewing source, do a CTRL+F and search for "form", you should find what you're looking for.

What you need to do is to add an onClick() event to your Submit/Commit button on the form to execute the following code:

 

function __doPostBack(eventTarget, eventArgument) {
            var theform = document.yourFormName
            theform.__EVENTTARGET.value = eventTarget
            theform.__EVENTARGUMENT.value = eventArgument
            theform.submit()
}
 
Replace 'yourFormName' with the name of the form you gathered by viewing source on the page (likely form1) and try it out. I've found so far that this has worked perfectly.
 
One thing I have noticed however is that this _does not_ seem to work in Chrome or Firefox.

Comments 1 CommentJump to latest comment

dfnkt_'s picture

I've found some task dialogs to have the form name 'aspnetForm'

+3
Login to vote