Output form javascript into a placeholder

By default any javascript required for forms is output inline after the closeure of the form (as you can see when viewing the HTML source). This may not be desirable for some developers as javascript order may be an issue. For simplicity it has been set this way by default for the majority of users that want to get their form up and running with minimal fuss. You can however use a placeholder command that allows you to output the javascript anywhere in your template.

To do this add the following code to your form object.

$o_form->setPlaceholderJavascript('FormItBuilder_javascript_myForm');

The string used in this method will be your placeholder name. Simply add the placeholder code to your template like so

<script src="assets/js/jquery.min.js" type="text/javascript"></script> 
<script src="assets/js/jquery.validate.min.js" type="text/javascript"></script>
<script type="text/javascript">
// <![CDATA[
[[+FormItBuilder_javascript_myForm]]
// ]]>
</script>

NOTE: Inline javascript includes the surrounding script and cdata tags. These are NOT included in the placeholder output.