This information is for building your own HTML forms to import into Forms inMotion.  Typically this information would be used by someone familiar with javascript/css/html development and information about working with those technologies is beyond the scope of this document.

Sample form code can be downloaded from Github.

Creating a new HTML form

HTML forms should be HTML5 compliant.  When developing a new form, you should keep in mind how these will be rendered by the Forms inMotion application.  The form itself will be displayed to the end-user inside of an IFRAME element inside the Forms inMotion application's HTML interface.  IFRAME can present unique security restrictive challenges in different browsers so forms should be tested thoroughly before deploying.

All fields should have an ID tag.  Seriously, we key off the ID and it is part of the XML output on the server.  A missing ID tag means that your field will not be represented in the XML output.  You can use the name tag in addition, but Forms inMotion server is only looking for ID.

Querying for external information

Since forms are HTML standard, it is possible to use external AJAX calls to talk to a webservice.  This is acceptable for many public data sources (Google Maps, data.gov, etc.) but not ideal for private sources.  For these, the recommended approach is to use the internal Query API as documented in the article "Using the Query API".  


Function calls when the document is loaded in the application

function PreDataLoad() {
	//your important loading stuff here
}

Another way to use these functions for testing OUTSIDE your Forms inMotion environment is to trigger your functions with jQuery .ready events such as below.

var alreadyLoaded = false;

$(document).ready(function() {
	PreDataLoad();
});

function PreDataLoad() {
	if (alreadyLoaded) {
		return;
	}
	alreadyLoaded = true;
	//your important loading stuff here
	PostDataLoad();
}


function PostDataLoad() {
	//your important post loading formatting stuff here
}


Notice in the above example the boolean flag to prevent executing the load call twice when it's been loaded into the Forms inMotion environment.  You should definitely implement this behavior to prevent HTML strangeness.

Data Validation Before Submission

It is also possible to include a function in your form that will run your own validation routines before submission.  If we don't find this function, we'll assume validation passed and continue submission.  The function must be named

VerifyFormDataCall

This can return true or false whether or not the validation passed.  A validation failed notification will be displayed if false is returned and submission will be cancelled.


Electronic Signature Inputs

<canvas style="width:550px; height:150px; " id="Signature" data-signature="Signature space for delivery"></canvas>

Using external includes in your form

<input id="myinputname" />
<input id="mycheckbox" type="checkbox" />
<input id="myradio" type="radio" />
<select id="myselectbox"><option value="stuff">Stuff</option></select>
<textarea id="mytextarea"></textarea>


Notes on Form Design

Default Saved Form Name

It is possible to automatically populate the save message for a form package using an input on your form.  This can be a hidden input but it must have an ID of "FORMSINMOTION_SAVENAME".

<input id="FORMSINMOTION_SAVENAME" style="display:none;" />

Related articles

Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.


Related issues
Component