You don't want to use multibox ... you need to set 'indexed="true"' on the html:checkbox control in the logic:iterate or c:forEach loop that displays your list.

Jignesh Kapadia wrote:

Hi ,
Thanks for your reply. Let me clarify liitle bit more.
Screen One
I am displaying a list of records from a list(which is List of an object). There is a boolean property in the object depending on which the check box should be checked or unchecked. Once the list is displayed. I should have an option to check and uncheck those records. Then I hit submit button
Screen Two
On this screen I should see only the records checked on previous page.
My questions are as follows:
1) How do I show the records with some checkboxes checked initially and some boxes not.(I don't know how many records will be there on the page )?
I can user html:checkbox to do that but then it does not pick up the change when you hit submit button and it goes to next screen.
2) Is there any way in html:multibox to show some check boxes checked initially and some boxes not in a list? since it intializes strArray in reset method.
I hope it helps ,
let me knoe if you need some more info.
Thanks,
Jignesh


Susan Bradeen <[EMAIL PROTECTED]> wrote:
Jignesh Kapadia wrote on 08/17/2004 10:14:20 PM:



John,
Thanks for your reply. This is a standard way of using multiple check boxes(i.e.html:multibox). If you read my earlier e-
mail the requirement is little bit different.Just explaining in brief again. say for example I have a list with 10 objects. I am displaying a list on a page with a check box. the object has a boolean property . depending on the value of the property the check box should be checked or unchecked initially.( In case of Multibox all of them are unchecked initially).


Now I can check and uncheck the check boxes my self on that page and when I submit the page the result should be displayed on the next

page.

Working with checkboxes can be tricky, and there is *a lot* about them in the archives. As you stated below, "On the next screen it should show me the updated records. i.e. records which are unchecked on previous page should be seen as unchecked and records which are checked on previous page should be shown as checked."

So, what in fact are you seeing on your next page? A partial list of only the ones previously checked? A full list with none of them checked? Something else? Are the values of the boolean property (the checkbox) coming from the database, and are they being displayed properly initially? What is "not working" in your observation?

A few more hints may better help us to help you ... :)


Let me know if anybody has come across this scenario with struts1.1.
This is a user requirement and we really don't know how do it. We tried both using html:checkbox and html:multibox but could not make it

work

if anybody can give their expert comments then it will be a good help,
Thanks,
Jignesh

[EMAIL PROTECTED] wrote:





To use a multibox, you need a getter and setter method in your form-bean
that returns/sets a String array.
Each element in this String array corresponds to the value of a checked
check-box.

Let's say you have a multibox coded like this:







ie
1) myFormBean has a method 'getDataBaseRecords' that returns a

collection.

2) Each object in the 'getDataBaseRecords' collection has a method
'getDescription', which is used to set the value of (and display

against)

the checkbox.
3) myFormBean has methods 'get/setSelectedDataBaseRecords' coded as
follows:

private String[] selectedDataBaseRecords = new String[0];

public String[] getSelectedDataBaseRecords() { return
selectedDataBaseRecords; }
public void setSelectedDataBaseRecords(String[] value) {
selectedDataBaseRecords = value; }


The effect of the above will be to generate html as follows:

[input] 1]" name=selectedDataBaseRecords>
[input] 2]" name=selectedDataBaseRecords>
[input] 3]" name=selectedDataBaseRecords>
[input] 4]" name=selectedDataBaseRecords>
etc.

Initially none of the check-boxes are checked because I've coded
'getSelectedDataBaseRecords' to return a zero length array.
If you were to check the second and third check-boxes and submit the

form,

'getSelectedDataBaseRecords' would then return an array of 2 elements,

with

the values '[description 2]' and '[description 3]'.



Regards,
John

[EMAIL PROTECTED]
Ph (09) 372-5010


|---------+-------------------------------> | | Jignesh Kapadia | | | | | @yahoo.com> | | | | | | 18/08/2004 12:33 PM | | | Please respond to | | | "Struts Users | | | Mailing List" | | | | |---------+------------------------------->

--------------------------------------------------------------------------------------------------------------
|
| |
| To: [EMAIL PROTECTED] |
| cc: |
| Subject: multiple checkboxes |

--------------------------------------------------------------------------------------------------------------
|




Hi ,
I have a scenario in our aplication which we are developing with
Struts1.1. on first screen we are displaying bunch of records
retrieved from database. Each record will have checkbox in first
column. This check box wil be initially checked or unchecked
depending upon the value of a bean attribute. A user can chsnge this
.He/She can check or uncheck any check boxes for any records.On the
next screen it should show me the updated records. i.e. records which
are unchecked on previous page should be seen as unchecked and
records which are checked on previous page should be shown as
checked.
I tried this using html:multibox tag but it is not working.
can somebody give a suggestion on this? It will be good help from your

side

if you can give your expert feedback ASAP.

Thanks,
Jignesh Kapadia



---------------------------------
Do you Yahoo!?
Y! Messenger - Communicate in real time. Download now.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!



_____________________________________________________________________________

Scanned for SoftLanding Systems, Inc. by IBM Email Security Management Services powered by MessageLabs.


_____________________________________________________________________________

_____________________________________________________________________________
Scanned for SoftLanding Systems, Inc. by IBM Email Security Management Services powered by MessageLabs. _____________________________________________________________________________


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------- Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to