API: Gui
Filename:
fwpGui_valueList
Released With:
5.2.2
Current Version:
1.0.0
Status: Active
Min Lasso Tested: 8.1.0
Max Lasso Tested: 8.5.3
Related:
Still don't get it?
Check out the talk list archives, or join and ask your questions.
Documentation Error or Request?
Email documentation corrections or comments
The fwp_valueList type creates independent objects which can be rendered as an HTML value list in the form of a popup menu, checkboxes, radio buttons, or list box. Each value list has one or more options and behaviors unique to its list type, but for the most part, all share a majority of common features and programming requirements.
Each value list style is able to display any combination of default selection(s) which represents an initial state or the state of an application variable, database field, or other data container. The draw code of the data type will generate all necessary HTML to display and control the value list including customized HTML attributes.
The list of selection options can be supplied to a value list object from an array of pairs, from a specially formatted text file, or from a specially structured data table. Generally speaking, the text files are the most common source as theyre convenient for grouping multiple lists in one place and, like many PageBlocks features, allow for site and module-specific versions. File contents are cached so performance is not hindered by repeated reading of the text file. The database table source is more effective for situations where several applications maintained as separate PageBlocks projects need to share a common value list source to avoid having to maintain redundant copies of config files.
//------ performed in the logic file ------------ var:'listName' = (fwp_valueList: -withoutCaching, -asVertical, -asHorizontal, -file = fileName, -table = tableName, -scope = 'site'|moduleName, -list = array_of_pairs | listName, -titleOption = '', -currentValue = '', -attributes = (map: 'disabled' = 'disabled'|optionsToDisable, 'id' = string, 'name' = string, 'class' = string, 'tabindex' = string|integer, 'onblur' = string, 'onfocus' = string, 'onchange' = string)); //------ performed in the display file ------------ $listName->(draw: -diabled = string, -currentValue = string, -tabIndex = string|integer, -id = string, -class = string);
Parameters Common to All Value List Types
-file - optional : defines which config file to use. Config file names follow the naming convention of valueList_{name}_ {language}.cnfg. The -file parameter declares the {name} part. The internal code will automatically determine language if is not passed by the -language parameter. So, to use the vaue list file valueLists_products_en-us.cnfg, you'd declare -file='products'. Refer to the section Preparing Value List Text Files for detailed information about file format.
-table - optional : the reference name of the data table to use from the $fw_gTables map. Pass just the reference name, not the $fw_gTables value. So, if $fw_gTables has entries like this
'pbrefc' = 'pbReference',
'vlists_en-us' = 'valueLists_en_us',
'vlists_it' = 'valueLists_it',
'appstrings_en-us' = 'appStrings_en_us',
'appstrings_it' = 'appStrings_it',
define the table like one of these methods
-table = 'vlists_en-us'
or
-table = 'vlists_' + ($fw_client:'language')
-scope - optional : applicable only if the -table parameter is used, this option defines whether a list defined as having site scope or module scope should be used. In the database table, lists which are applicable to the whole site are defined in the listScope field with "site" as the scope. Lists which are applicable to a specifc module are defined with listScope as the name of that module (using the module folder name).
-list - required : defines the exact list to use. This can either be an array or an array of pairs to hard code a list or pass a dynamic list. It will most typically be the list name of a list definition from a config file or data table.
-titleOption - optional : the behavior of this one changes depending on list style. For popup and listbox lists, this defines a extra selection option to appear at the top of the list. Typically this would be used to add a "Please select..." or a blank entry at the top of the list. This allows the same list to be used for multiple displays. For example, in a data entry form, the list can have "Please Select..." at the top while in a search form could have "All" at the top. For checkbox and radio buttons, this parameter will add a <fieldset> around the tag with the <legend> containing the titleOption value.
-currentValue - optional : declares a value that should be selected/checked when the list is drawn. For popups and radio buttons, this must be a single value. For checkboxes and list boxes, this can be a single value or multiple values declared as a single string delimited with \r. This format was chosen to make it easier to pass field contents which retain the \r formatting of the original selection.
-withoutCaching - optional : this parameter has no value. It declares that the resulting HTML generated from this list should not be cached. usually lists should be cached for better performance, but there are occasions where the list should not be cached because it is subject to dynamic content changes.
-attributes - required : a map of HTML attribute name-value pairs. For popups and list boxes, this declares the attributes of the <select> tag. For radios and checkboxes, this declares the attributes of each <input> tag. The minimum requirement is for the attribute name to be declared. All others are optional. See the Defining Attributes section for more details.
Parameters Specific to Radio Buttons and List Box Lists
-asVertical - optional : declares the the list should be displayed vertically. Each list item is separated with a <br />.
-asHorizontal - optional : declares the the list should be displayed horizontally. Each list item will have three trailing
For popups and list boxes, attributes are applied to the <select> tag. For radios and checkboxes, attributes apply to each <input> tag. The minimum requirement is for the attribute name to be declared. All others are optional, some are added with default values (explained below).
The attributes values are supplied as a map when the object is created. Each attribute in the map is added exactly as submitted (exceptions are explained in the Default Attributes section below). This allows the developer to customize attributes as needed, and even allows for non-standard or future standards to be accommodated.
Default Attributes
There are member tags for drawing each list type:
->drawAsPopup
->drawAsRadioButtons
->drawAsCheckBoxes
->drawAsListBox
Parameters for Drawing
If all parameters are defined at the vlist creation, the drawing tags need no parameters, However, while all parameters can be defined at object creation, there maybe occassion to specify some details at the time the HTML is drawn. The draw tags allow for the these parameters to be defined:
-disabled
-currentValue
-tabIndex
-id
-class
This code creates a popup menu where the list options have been pulled from the file valueLists_general_en-us.cnfg, the current month will be preselected, and where upon selecting a value, the onchange attribute will run the JavaScript function jumpToPage.
var:'jumpToMonth' = (fwp_valueList -file = 'genl', -list = 'monthsLong', -titleOption = 'Pick a calendar to view...', -currentValue = (date->month:-long), -attributes = (map: 'name' = 'jumpToMonth', 'tabIndex' = 9, 'onchange' = 'jumpToPage(this.value)')); $jumpToMonth->drawAsPopup
This list will display the days of the week as horizontal checkboxes, and disable the Sun and Sat boxes.
var:'m_availableDays' = (fwp_valueList: -file = 'genl', -list = 'daysShort', -attributes = (map: 'name' = 'm_availableDays')); $m_availableDays->(drawAsCheckBoxes: -disable = 'Sun\rSat')
© 2002-2012, pageblocks.org