I am building a form element by element based on user responses. I have an action page that is called after a certain response occurs .
the action page has an invoke of a cfc that reads a database of form elements and returns the results to the action page where they are output
Below the output of the form elements I have some javascript which will pre-populate some of the values of the newly added form elements.
However, it seems my Javascript always executes before the output of the form elements . this means I can not update the values of the elements because they do not exist yet. If I pause my Javascript the elements do not get drawn until I allow it to continue. JS is jumping in first.
Is there a method to make JS not execute until the from elements are drawn?
Top to bottom placement does not seem to matter.
Example:
<cfinvoke> go get the form elements
<cfloop> output the elements
<javascript> look up hidden form elements and populate the new form elements.