Form Enhancements are synchronous - why?

Jul 24, 2013 at 8: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?
Coordinator
Jul 26, 2013 at 1: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.

M.
Jul 26, 2013 at 4: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.
Coordinator
Jul 26, 2013 at 4: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!

M.