NSOA.form.getAllValues()

Use this function to get an Associative Array of all the fields and values on the form. Keep in mind, any pick lists (for example Customer:Project, Employee, Expense item) will return an internal_id and not a text value. In this release, only fields directly related to the form are available (for example no related table lookups are available now). See also NSOA.form.getValue(field).

Parameters

(none)

Returns

An Associative Array of all the fields and values on the form. Use the Form Schema to find the names and data types returned.

Note:

Some fields return an object. See Object Fields for more details.

Units Limit

10 units

For more information, see Scripting Governance.

Since

August 17, 2013

Example

  • This example creates a local variable called allValues with an Associative Array of all the fields and values on the form. It then reads the project_name and start_date from the allValues variable.

                        var allValues = NSOA.form.getAllValues();
    
        var project_name = allValues.name;     // equivalent to getValue('name');
        var start_date = allValues.start_date; // equivalent to getValue('start_date'); 
    
                  

    See also NSOA.form.getValue(field).

    Note:

    Some fields return an object. See Object Fields for more details.

  • You can loop through the keys of an associative array with the for in loop.

                    // Get all the values on the fields on the form
    var allValues = NSOA.form.getAllValues();
    
    //Loop through all the values
    for( var key in allValues ) {
        NSOA.meta.alert(key + ' has value ' + allValues[key]);
    } 
    
                  

    See NSOA.form.getAllValues() and NSOA.meta.alert(message).

See Code Samples for more examples.