Form Elements

There are several ways you can present data in Component Enabler using JavaScript, each is represented as a different HTML form element. These are:

Note: Drop-down combo boxes and drop-down lists are not supported.

Each of the objects listed above, must be accessed in a different way to get the data required. Before you can correctly access the object, you must determine its type. Refer to CopyFieldToForm() function in dwtest.html, for an example of a case statement which determines the type of the object.

Note: In the dwtest.html sample, the case statement is within an IF condition for radio button groups. Radio button groups are stored as an array of radio buttons, all having the same name. The array itself is meant to have an object type of radio. If the code encounters an undefined object type, it tries to access it as an array of radio buttons, and if successful, looks for and checks the value sent from the host.

A simple field example is:

<INPUT type="text" name=top_line size=19>

Lists or selects are essentially list boxes. When the code encounters an object type of select-one, it tries to fill the select with a list of the name <Ispec name>. <field name> (LINC LBX; attribute is set for the field). If that is not found, it searches for *.<field name> (LINC LBX;* attribute is set for the field). If it finds the list, it sets the select to show the items from the list, with the first column being the one sent to the host, and the second column being the one presented to the user. If neither list is found, the list is not filled.

If these assumptions are not valid for your select, you can copy the setSelectionSelected() function to the particular Ispec and modify it to get the lists and columns you want.

Selects with no size or a size of one, appear as drop-down list boxes. If the size is greater than one, they appear as normal lists. A select-multiple is normally created when the MULTIPLE attribute is set on the object and means that multiple items in the list can be selected at the same time. To allow normal list boxes, select-one and select-multiple have the same code. If you wish to use a true select-multiple, you need to provide your own code, particularly, for passing multiple selections back to the system.

A list box example is as follows:

<SELECT name=test onChange="parent.parent.copyFormToIspec();true">
<OPTION VALUE=T0010>OPTION VALUE=T0010
<OPTION VALUE=T0020>Zero Suppress Testing
<OPTION VALUE=T0030>Various Numeric Testing
<OPTION VALUE=T0040>SwitchTo Testing
<OPTION VALUE=T0050>Screen with no Input
<OPTION VALUE=T0060>Error and Attention Messages
<OPTION VALUE=T0070>Button Testing
<OPTION VALUE=T0080>Dynamic list box testing
<OPTION VALUE=T0082>Small Multiple Buffer Dynamic List box
<OPTION VALUE=T0090>Color Test
<OPTION VALUE=T0100>Test Pattern
<OPTION VALUE=T0110>Cursor Positioning
<OPTION VALUE=T0120>Busy Screen
<OPTION VALUE=T0130>Kanji Screen
<OPTION VALUE=T0140>Static List box Testing
<OPTION VALUE=T0150>Lots of Data
<OPTION VALUE=T0160>Run Reports
<OPTION VALUE=T0170>Clear.When and SP Testing
</SELECT>

A radio button example is as follows:

<INPUT TYPE=radio NAME=ps_value VALUE="1"> One
<INPUT TYPE=radio NAME=ps_value VALUE="1"> One
<INPUT TYPE=radio NAME=ps_value VALUE="2"> Two
<INPUT TYPE=radio NAME=ps_value VALUE="3"> Three
<INPUT TYPE=radio NAME=ps_value VALUE="4"> Four
<INPUT TYPE=radio NAME=ps_value VALUE="5"> Five
<INPUT TYPE=radio NAME=ps_value VALUE="6"> Six
<INPUT TYPE=radio NAME=ps_value VALUE="7"> Seven
<INPUT TYPE=radio NAME=ps_value VALUE="8"> Eight
<INPUT TYPE=radio NAME=ps_value VALUE="9"> Nine
<INPUT TYPE=radio NAME=ps_value VALUE="10"> Ten

Refer to the JavaScript reference manual for other FORM elements you can use.