Mobile Forms to Collect Field Data faster

FREE SIGNUP
Features Getting Started

Scripting Form State Changes

Execute on Submit of Form

Description: code that is executed when a Form is submitted. Can be used to validate a form or create new items with values input in the Form. Note that this does not apply to workflow based templates. See the next section.
Where to enter code: Edit Template in web account / Submit tab.
Syntax: The code must return true or 1 for the form to be submitted. If return value is 0, form status is not updated to SUBMITTED
Examples
Validate Contact Email on Form Submission:
var email = F1.trim().toLowerCase();
            var level = F2;
            var count = Query.count("Contacts.contacts", "email=" + esc(email));
            if (count > 0) App.alert('Email already exists!');
            else {
                var id = Query.insert("Contacts.contacts", {name:email, email:email, creationdate: Date.now() });
                CustomFields.values = CustomFields.loadValues();
                CustomFields._update("Contacts.contacts", id, "F3", level);
                App.alert('Contact inserted!');
            }
            return 1;
Direct user to a web page after a Form is submitted:
App.web('http://www.google.com');
            return 1


Execute on Load of State in Workflow-based Forms

Description: code that is executed when a Form State is reached. Can be used to create new items with values input in the Form. In this case, the Execute on Submit does not apply.
Where to enter code: Edit Template in web account / Workflow tab / Edit State
Syntax: The code must return true or 1 for the form state to be submitted. If return value is 0, form state is not updated to the next state

Make your business mobile with Upvise

FREE SIGNUP



Get it on Google Play Download it on AppStore