Built-in ‘system functions’ for common tasks in Scripts

What is a system function?

There are a number of common tasks that a lot of ZumeForm Users need done on a regular basis. Rather than requiring each User to write their own Scripts to performs these functions, we have built a number of these common functions into the ZumeForms platform.

You can use these functions by simply calling the built in system function.

getGender()

This system function determines the gender of someone based on the answer to the salutation Form Field of the person combo Field:

// This is based on the 6 item salutation Form Field 'Sal_cho' (Mr, Mrs, Miss, Ms, Dr (m), Dr (f))
// Where the value returned to variable ‘gender’ is male or female.
var gender = getGender(fld('Sal_cho').val());

getAge()

This system function determines the age of a person based on the value of a date Form Field:

// Where value passed in a date of birth from the field.
// This calculates an age based on the content of the date field.
var age = getAge(fld('DOB_dt').val());
// Set a field to an age when a date Form Field is changed, place this Script in the date Form Field:
fld('Age_Field_scr').val(getAge($(this).val()));

calcMinor(age)

This function will search a Form for a particular Form Field and calculate if the value of that Form Field is less than the age that is passed into the field, i.e. ‘age’:

// The variable ‘isminor’ will return 'true' if any of the values of Child_Age_scr are below 18.
var isminor = $("[name$='Child_Age_scr']").calcMinor(18);

isTrue(), for Yes/No Group, Radio Button CheckBox Group

This system function determines whether a checkbox Form Field is ‘true’:

// If one of the items checked has a 'true' value, it will look for the word ‘true’.
$('CheckBoxName_chk').isTrue();

isFalse(), for Yes/No Group, Radio Button CheckBox Group

This system function determines whether a checkbox Form Field is ‘false’:

// If one of the items checked has a 'false' value, it will look for the word ‘true’.
$('CheckBoxName').isFalse();

isChecked(), for Yes/No Group, Radio Button CheckBox Group

This system function determines whether a checkbox Form Field is checked:

// Does not look at values, only looks to see if any item is 'checked'. If any item is checked then it returns ‘true’.
$('CheckBoxName').isChecked();

CheckedValue(), for Yes/No Group, Radio Button CheckBox Group

This system function determines the checked value of a checkbox Form Field:

// This will return the actual value checked.
$('CheckBoxName').CheckedValue();

SelectedValue(), for Dropdown List and List Box

This system function determines the value that has been selected in a drop down list:

// Returns the value selected out of a drop-down or list.
$('DropDownName').SelectedValue();

changeVal()

This system function triggers the script to run on another Form Field:

// triggers the Scripts on fldname to run as if the value of that field had changed
$('fldname').changeVal();

sumValues(), for use within a Repeat Section

This system function totals the value of a Form Field within a repeat:

// Adds the values of the identified Form Field within a Repeat Section
// Should be included in the Form Field that is being added, so that it updates.
var sum = $('fldValue').sumValues();
fld(‘fldTotal’).val(sum);

Any()

This system function looks to see if there are any fields on a form:

fld('fldname').Any();