Update of /cvsroot/phpwebapp/web_app/webobjects/listbox
In directory sc8-pr-cvs1:/tmp/cvs-serv27019/webobjects/listbox
Modified Files:
listbox.txt listbox.html
Log Message:
Added the attribute optional 'value' to webclass listbox.
Index: listbox.txt
===================================================================
RCS file: /cvsroot/phpwebapp/web_app/webobjects/listbox/listbox.txt,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** listbox.txt 16 Jul 2003 09:27:59 -0000 1.3
--- listbox.txt 24 Sep 2003 14:12:30 -0000 1.4
***************
*** 18,24 ****
--- 18,34 ----
<Include SRC="{{LISTBOX_PATH}}listbox.html" />
<WebObject Class="listbox" Name="country"
+ value = "selected_value"
rs = "rs_id"
onchange = "alert(this.options[this.selectedIndex].text)"
width = "---------------" />
+
+ The attribute "value" is optional. It has the value of the selected item
+ (the item with id equal to this value is the one that will be selected).
+ It can be a variable, like this: value="{{var_name}}", in this case the
+ value of this variable is used. If it is not given, then its default
+ value is '{{{{obj_name}}}}' (in the example above, it would be '{{country}}',
+ since the name of the object is 'country'; this means that the value of
+ the variable {{country}} will determine which item will be displayed as
+ selected).
The attribute "rs" is optional. Its default value (if not specified) is
Index: listbox.html
===================================================================
RCS file: /cvsroot/phpwebapp/web_app/webobjects/listbox/listbox.html,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** listbox.html 21 Feb 2003 08:17:06 -0000 1.1.1.1
--- listbox.html 24 Sep 2003 14:12:31 -0000 1.2
***************
*** 1,16 ****
<WebClass ID="listbox">
! <Parameter name="rs" default="{{obj_id}}" />
<Parameter name="onchange" default="return false;" />
! <Parameter name="width" default="" />
!
! <select name="{{obj_name}}" onchange="{{onchange}}">
! <Repeat rs="{{rs}}">
! <Var name="selected">('{{id}}'=='{{{{obj_name}}}}' ? "selected" : "")</Var>
! <option value="{{id}}" {{selected}}>{{label}}</option>
! </Repeat>
! <If condition="'{{width}}'<>''">
! <Var name="selected">('{{{{obj_name}}}}'=='' ? "selected" : "")</Var>
! <option value="" {{selected}}>{{width}}</option>
! </If>
! </select>
</WebClass>
--- 1,16 ----
<WebClass ID="listbox">
! <Parameter name="rs" default="{{obj_id}}" />
! <Parameter name="value" default="{{{{obj_name}}}}" />
<Parameter name="onchange" default="return false;" />
! <Parameter name="width" default="" />
! <select name="{{obj_name}}" onchange="{{onchange}}">
! <Repeat rs="{{rs}}">
! <Var name="selected">('{{id}}'=='{{value}}' ? "selected" : "")</Var>
! <option value="{{id}}" {{selected}}>{{label}}</option>
! </Repeat>
! <If condition="'{{width}}'<>''">
! <Var name="selected">('{{value}}'=='' ? "selected" : "")</Var>
! <option value="" {{selected}}>{{width}}</option>
! </If>
! </select>
</WebClass>
|