Automatically Submit after X Minutes


 

This form will be submitting automatically after 10 minutes.  This example uses some javaScript in the onNew event to programmatically trigger the submit button.  The javaScript is:


if secureJS = false, in the Builder_config.properties file

//Will trigger the submit button after 10 minutes has
//passed since the form was opened.
setTimeout(function(){
var actionButtons = form.getStageActions();
for(var i=0; i<actionButtons.length; i++){
  if(actionButtons[i].getId() === 'S_Submit')
     actionButtons[i].activate();
}},600000);


if secureJS=true, in the Builder_config.properties file

setTimeout(function(){
var actionButtons = form.getStageActions();
for(var i=0; i<actionButtons.length; i++){
  if(get(actionButtons, i).getId() === 'S_Submit')
     get(actionButtons, i).activate();
}},600000);


There are some key things to remember:

1.  You must redirect user after the form submission, in the properties of the Submit button in the Stages tab

or 

2. You must change the form to render in the next stage

If you do not do one of these two things then this will cause the form to get stuck in an endless loop of opening a new form and then submitting it (which becomes really apparent if you shorten the submit timing to 1s).  However if a user closes the form then the javaScript is not executed.

This form re-directs to www.ibm.com