Workflow Soluiton

 View Only

Forcing a postback in workflow to deal with an editable datagrid 

Mar 28, 2011 05:15 PM

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.

Statistics
0 Favorited
0 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Comments

Mar 30, 2011 09:34 AM

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

Related Entries and Links

No Related Resource entered.