You are viewing limited content. For full access, please sign in.

Question

Question

Forms Sequence

asked on August 1, 2016

Does anyone know the sequence of what happens/when a Form opens up?  For example, DOM, field rules, lookup rules, then JS.  Basically just trying to get some ordering down.

Thanks,

Chris

0 0

Replies

replied on August 1, 2016

Chris,

This is tough to answer because many things are asynchronous. In general, if you want to guarantee something happens before something else, you should use some kind of event handler to explicitly set the order. Here's what I can tell you about the ordering:

The DOM loads. The field rules appear to be handled by some JavaScript event handlers that get attached to change events of the associated with the input fields. At the same time, the form triggers AJAX requests for the lookup rules. When these rules actually return data is variable, depending on the amount of data and the latency between the client->forms server and the forms server->sql server. The custom Javascript you write is also loaded as a part of the DOM, and may be running before DOM is completely loaded or the lookup rules return any data. In general, if you want to manipulate the DOM, you want to wrap your code in the jQuery $(document).ready(function(){  }) event handler to ensure that it runs after the DOM is fully loaded. If you are trying to respond to when the lookup rules have finished loading, that can be tricky. It would be nice if Forms provided some custom events that you could write an event handler to respond to in this regard... I have written some of my own solutions to address that issue, but none of them are perfect. Usually, I just try to write my own ajax request and trigger it so that I can listen for the callback explicitly.

2 0
replied on August 1, 2016

Awesome Scott, thank you for the reply.  I'll take a look at this and see what I can find.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.