function writeln(str) { write(str + "\n") } writeln("
") function parseList( sList ) { aRes = null; if ( null != sList && ""!=sList ) { aRes = new Array(); nStart = 0; nIndex = 0; do { nCommaPos = sList.indexOf( ',', nStart ); if ( nCommaPos != -1 ) { sEntry = sList.substring( nStart, nCommaPos ); nStart = nCommaPos+1; } else { sEntry = sList.substring( nStart ); } aRes[nIndex++] = sEntry; } while ( nCommaPos != -1 ); } return aRes; } function netscape_peas_StaticSelect(params) { // now generate the client object if ( ""==params.textOptions ) { params.textOptions = null; } if ( ""==params.valueOptions ) { params.valueOptions = null; } writeln( "
" ); } // netscape_peas_StaticSelect

StaticSelect Component

This page illustrates the StaticSelect JavaScript Component. This component accepts as properties two coma separated lists: one for the display texts for the pick list and one for their corresponding values. The StaticSelect is visible both on the client and on the server. Its .JSB files uses the "BOTH" value for its "ENV" attribute.

Because this component emits an HTML <SELECT> tag, it must be placed inside an HTML <FORM> tag.

One nice feature of the component is that it exposes (in its JSB) file, a bound property called value, and provides setValue() and getValue() functions. A bound property is one which fires an onChange event when its value changes. Because of this support, it can be easily wired to other standard components, using a tool such as Visual JavaScript. Below are two Static select components, both wired (by Visual JavaScript) together with text fields.

Also specified in its .JSB file is the VISUAL attribute is set to a Java class which draws the component in WYSIWYG page builders, like the one in Visual JavaScript.

To run this example one must manually (or with the help of VJS) copy, compile, and add the resulting Crossware Application to an enterprise server.

//automatically generated script _param_ = new Object(); _param_.defaultValue = "Soup"; _param_.textOptions = "Cream of Mushroom Soup,Caesar Salad"; _param_.size = 2; _param_.valueOptions = "Soup,Salad"; _param_.id = "StaticSelect1"; StaticSelect1 = new netscape_peas_StaticSelect(_param_);

//automatically generated script _param_ = new Object(); _param_.defaultValue = "Salmon"; _param_.textOptions = "Stuffed Eggplant,Grilled Salmon,Filet Mignon"; _param_.size = 1; _param_.valueOptions = "Eggplant,Salmon,Filet"; _param_.id = "StaticSelect3"; StaticSelect3 = new netscape_peas_StaticSelect(_param_);