This project has moved and is read-only. For the latest updates, please go here.

Form Enhancements are synchronous - why?

Jul 24, 2013 at 9:13 PM
Some Form Enhancement functions provided make synchronous calls to the Sharepoint Web Services. Why is this?

For example, SPFilterDropdown calls GetList and GetListItems with async: false.
Comment in the code reads:
// Force sync so that we have the right values for the child column onchange trigger
async: false,
I'm not exactly sure why it's important that it's synchronous here. Could anyone explain it to me?
Jul 26, 2013 at 2:13 AM
Because calls to these functions can be "stacked up", I want to be sure that the previous call has completed and the function is done before allowing the next instance to do anything.

Jul 26, 2013 at 5:23 PM
Thanks, that makes sense.

I'm currently using SPLookupAddNew opening in a new window with SPFilterDropdown to refresh the Lookup choices every 3 seconds, without requiring the page to be reloaded. As a result, processing tends to block during that request, which results in the page freezing until it finishes.

I may look for a better way to do this, though.
Jul 26, 2013 at 5:47 PM
Obviously, since it's script and open source, you can feel free to make any adjustments that you want. I'd just be careful, as it took me a long time to get things where they are and I've already lived through more timing issues than you want to!