I'm going to assume that we're talking straight html, and not javascript
and/or client-side java.
In that case, you would have a textbox and a button, and a checkbox, a
description field, and (another) button.
Because ND does not have a 'checkbox group', you will have to put the
checkbox within a repeated item (check the html widgets) on the page, and
govern the number of times that the checkbox is displayed. Make the
standard checkbox label be blank, and position the description field
(static text) where the label would be. Do not put the button within the
CSpRepeated
(Grace, if you want to suggest a superclass, have at it)
Unfortunately I don't have time to look up methods.
Your page will have 3 modes:
'select' mode' when you display the text input to retrieve the rows to
paint the checkboxes
'checkbox mode' when you display the checkboxes
'continue mode' when the user has checked checkboxes and pressed the
associated button.
Create a member variable to keep track of the mode. Set it at the outset
of each page event that is executed at the beginning of a web event:
onBeforeLoadEvent - 'select'
onWebEvent for button associated with textbox - 'checkbox'
onWebEvent for button associated with checkboxes - 'continue'
Display or suppress all field widgets based on the mode (test member
variable). One way to do this is test in onBeforeDisplayEvent of widget,
return SKIP to suppress it. For the checkboxes, do this in
onBeforeDisplayEvent for the CSpRepeated that will contain them, not the
checkbox widget and description field.
textbox - display in 'select' mode
button with textbox - display in 'select' mode
CSpRepeated for checkbox - display in 'checkbox' mode
button for checkboxes, - display in 'checkbox' mode
onWebEvent for button associated with textbox: set mode to 'checkbox',
get value from text box,
get reference to data object,
clear dynamic criteria on data object,
add dynamic criteria to data object
execute dataobject
test succeeded on do
---if true:
--- set CSpRepeated max rows size to number of rows in results set.
--- cycle through the results set
--- build a Vector or CSpVector containing the value from each row in the
results set:
------put it into an member variable
------put it into a session object (or a page session object or a hidden
field, anyone can argue I don't care).
---if false
--- either throw exception or set member variable for results set to null.
onBeforeRowDisplayEvent for CSpRepeated:
if member variable for results set is null return STOP
get rowIndex from event argument.
get reference to checkbox widget
get reference to description static text field
set checkbox widget to either its defined 'checked' or 'unchecked' value,
depending on whether or not you want the boxes to be
checked when the page displays.
use rowIndex as index into Vector or CSpVector (member variable) of
retrieved values, set the value into the description field.
(all of this will be done as many times as there are rows in the results set).
onWebEvent for button associated with the checkboxes:
set mode to 'continue'
get reference to checkbox widget.
get the description values Vector/CSpVector out of the session object (or
wherever)
call getValue on checkbox. the return will be a CSpValue.
If only one checkbox was displayed, the CSpValue will be the standard
single-value return that you would have gotten if you had made a simple
page with one checkbox, i.e., the 'checked' value or the 'unchecked'
value, depending on how it was set up and whether or not it was checked.
If more than one checkbox was displayed, the return will be a CSpVector
containing the 'true' or 'false' entry for each checkbox, in the order in
which the checkboxes were displayed.
to smooth over this difference, do the following:
CSpValue value = checkbox.getValue();
CSpVector values;
if (value instanceof CSpVector)
{
values = value;
}
else
{
values = new CSpVector();
values.put(value);
}
now you will have a Vector or CSpVector of the values you retrieved from
the data base, and a matching CSpVector of 'checked' or 'unchecked'
(depending on how you defined the checkbox) values, indicating whether or
not the corresponding data base value was checked (or left checked) by the
user.
Create an empty Vector or CSpVector. Cycle through the vector of database
values. For each one, if the corresponding entry in the vector of checkbox
return values was 'checked' , drop it into the new vector. The result will
be the list of checked values.
-- Curt Springer, Team NetDynamics
At 11:12 AM 4/16/99 -0400, [EMAIL PROTECTED] wrote:
>Hi,
>
>I am new to ND. In fact, this is my first project using this tool.
>
>I have to implement this UI feature where I have to dynamically fill the
>value list
>for a multi-values checkbox group base on a keyword input by the user.
>
>For example:
> keyword input : 100
> (press the button which will retrieve all values that start with
>100 and place them in the checkbox group )
> ==> Multi-values checkbox group :
> 1001
> 1002
> 1003
> .
> .
> 100N
>Greatly appreciated for any help on this,
>
>Vinny
>
>
>_________________________________________________________________________
>
>For help in using, subscribing, and unsubscribing to the discussion
>forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
>
>For dire need help, email: [EMAIL PROTECTED]
>
_________________________________________________________________________
For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
For dire need help, email: [EMAIL PROTECTED]