Hello,

I can't find how to implement a form which include n*m checkbox.
I would like to get :

                doc1    doc2    doc3    ...     docn
client1 x               x               x
client2         x       x               x
client 3        x       x       x               
...
client m        x       x       x               x

I managed to get the form but I can't retrieve the values in the validate function

private String[][] enveloppes;

in reset : 
enveloppes = new String[n][m];
for(int i = 0; i < m; i++) {
        for (int j=0; j < n; j++) {
                enveloppes[j][i] = "off";
        }
}
and for example, i get an array of 2*10 elements.
but when I check the size of enveloppes into the validate function, I get a strange 
size of 1*1.

There is also the getter/setter :
    /**
     * @return Returns the enveloppes.
     */
    public String[][] getEnveloppes() {
        return enveloppes;
    }
    /**
     * @param enveloppes The enveloppes to set.
     */
    public void setEnveloppes(String[][] enveloppes) {
        this.enveloppes = enveloppes;
    }

Does anyone know the reason why the enveloppe size isn't 2*10?
I tried to log a lot of stuff and was not able to determine anything. The setter is 
apparently never called. 
I guess Struts is in charge of populating the form when it is sent back by the browser.
I managed to use array of 1 dimension with struts form, even if I had quite a hard 
time to figure out how to make it works but
I can't find any solution for 2 dimensions arrays.

the generated html corresponding parts are :

...
                                        <td><input type="checkbox" 
name="enveloppes[0][7]" value="on"></td>
                                        <td><input type="checkbox" 
name="enveloppes[1][7]" value="on"></td>
                                        <td><input type="checkbox" 
name="enveloppes[0][8]" value="on"></td>
                                        <td><input type="checkbox" 
name="enveloppes[1][8]" value="on"></td>
...

Thanks for the help,

Damien

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

Reply via email to