Hi !

Thank you for you help, it works fine now !

BTW, it seems like Struts does not support all standart HTML options : I had to use a pure HTML 
<INPUT> tag because the "readonly" attribute does not exist in Struts, and I 
think this mix is a bit dirty. But it works...
("onLoad" not supported either...)

Olivier Croisier


This is a problem with HTTP: when all the checkboxes are deselected, the
browser doesn't send anything back, so you get the default of what you
started with. To solve this problem you must ensure that at least one box is
always selected.

I solved this problem by creating an additional checkbox that is hidden,
read-only and selected. This will ensure that the browser sends something
back.

String[] defaultEntities = {"A", "B", "C", "D", "filler"};

<tr style="display:none;"><td><html:multibox property="marketing"
value="filler"/></td></tr>

Wiebe

-----Original Message-----
From: Olivier Croisier [mailto:[EMAIL PROTECTED]
Sent: Friday, November 12, 2004 6:47 AM
To: [EMAIL PROTECTED]
Subject: Multibox deselection problem

Hi !

I have a problem with the Multibox behaviour. I have checked the online doc
but nothing helped me so far... Here is my problem :

My app workflow is :
prepareImportAction.do  ->  Import.jsp  ->  processImportAction.do

In the prepareImportAction.do, I initialize the "entities" var (of type
String[], in session scope), so that the checkboxes are checked by default
when the jsp page is displayed :
        String[] defaultEntities = {"A", "B", "C", "D"};
        myform.set("entities", defaultEntities);

In the jsp page, I have a set of :
        <html:multibox property="entities" value="A"/>
        <html:multibox property="entities" value="B"/>
        <html:multibox property="entities" value="C"/>
        <html:multibox property="entities" value="D"/>

I also have a small javascript that allows the user to select or deselect
all checkboxes in one click :
        function checkAll(field)
        {       var i;
                for (i=0;i<field.length;i++)
                {   field[i].checked=true;   }
        }
(nearly the same for de-selecting all checkboxes)

Now here is my problem. When I de-select all the checkboxes in my jsp page,
by hand or by javascript, my processImport.do receives a String[] array
containing the entities that were defined in preparaImport.do as default,
instead of an empty array.
This only happens only when all entities are deselected : if a single one is
selected, I get the desired behaviour.

May you help me to understand where I am wrong and why it doesn't work
please?

Olivier Croisier




-- CROISIER Olivier Software Engineer Thales IS - ANS [EMAIL PROTECTED]

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



Reply via email to