getElementValue( id, autocompUseValueField )



This function retrieves an element value by id. The value can then be passed to a JavaScript function, AJAX request, or some other process. Leading and trailing spaces are not trimmed with this function.

Parameters:

  • id string or reference to DOM element – required. identifies the element whose value will be retrieved.

  • autocompUseValueField - optional. 1 For use with textbox autocomplete widgets. Set to true to make getElementValue return the autocomplete value, not the value displayed in the widget. By default, getElementValue returns the value displayed in the textbox. Passing true in the 2nd argument causes getElementValue to return the same value that would be submitted to the server-side program when autocomplete is configured. When textbox's "choice values field" property is set, then the value submitted to the server-side program is one of:

    1. the value from "choice values field" if an autocomplete choice was picked, or the text matched an autocomplete option.

    2. blank if user's input matched no autocomplete values and the Force Auto Complete Match configuration option is not set to false.

    3. the value from the textbox if Force Auto Complete Match is false and the textbox value matches no autocomplete options.

Return value:

A string.

  • Select boxes whose "choice values field" or "choice values" properties are set, the value returned is the value of the matched "choice value"; if no choice was picked, then an empty string is returned.

  • Combo boxes. If "choice values field" or "choice values" properties are set, then the value returned is the value of the matched "choice value"; if no choice was picked, then the user input or an empty string is returned.

  • Text boxes. With no 2nd argument, the value returned is always the value displayed in the textbox. See description above of autocompUseValueField if the 2nd argument is true.

  • Check boxes.  If the "checked value" and "unchecked value" properties were specified, returns the appropriate value; if not specified, returns true if the box is checked, false otherwise.

  • Radio buttons. Returns true if the radio button was been selected, false otherwise. 2

Examples:

var value = getElementValue("SelectBox1"); var value2 = getElementValue("TextBox1", true); var comboBox = getObj("ComboBox1"); var value3 = getElementValue(comboBox);



1 This parameter is available in versions of Profound UI later than Version 6 Fix Pack 12.0.

2 Radio button support us available in Profound UI version 6, fix pack 16 or later.