Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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 DOM reference to DOM element – required. identifies the element to retrieve the value from

...

  • 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.

Examples:

Code Block
JavaScript
JavaScript
var value = getElementValue("SelectBox1");

var valuevalue2 = 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.