Section | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
This JavaScript example is relevant to Forms only. Let's say you have a new customer registration Form A that is normally forwarded to Forms B and C to complete registration for a new user. Returning Users skip Form B and go directly to form C.
This JavaScript example will automatically submit a form if a certain control has some specific value (say “not-new”) in it when the form is loaded. This might be useful in cases where a form needs to be submitted to post the data in it, but interaction between the form and user is not necessary. If the user's input is not required, this custom JavaScript can submit the form automatically.
...
Add conditional-submit to the CSS Class property of the control whose value is to be compared.
Automatically Submit a Flow Step
Flow steps only allow for one email document action, but there are cases where you may want to configure a second email to send from the same flow step. If the step is at the end of the flow, you can use Flow Doc Actions to accomplish this task. For steps in the middle of a flow, create an additional linked step, set up the second email document action on the added step, and then use a script to automatically submit that step so the users will not see it. The script is similar to that for Auto-Submit a Form, but one key difference is that you will need a rule on the form that sets your conditional-submit control to the value specified in the script ("next" in the example below) on the step that should auto-submit, and then use the else action to set that control to empty on all other steps. Add conditional-submit to the CSS Class property of the control whose value is to be compared.
Code Block |
---|
var CustomEventHandlers = {
submitEl: null,
setup: function (el) {
if (CustomView.hasClass(el, 'conditional-submit')) {
window.setTimeout('CustomEventHandlers.conditionalSubmit()', 2000);
this.submitEl = el;
}
},
conditionalSubmit: function () {
var isValue = "next";
if (this.submitEl.value == isValue) {
FlowView.getFlowButton().onclick();
}
},
} |
Extra Submit button
By default, each form has a submit button located at the end of the form. The forms designer lets you easily add additonal submit buttons in a special area at the end of a form only. You can use the following JavaScript to create an extra submit button. Add a trigger control to your form and set auto-submit in the CSS Class property. Now you can use this trigger control as your Submit button and place it anywhere on your form.
...
This JavaScript example will submit the form when the user presses the Enter key. If you want to do this in a flow, change SubmitView.doSubmit("Submit"); to FlowView.getFlowButton().onclick();
...