Re: MATRIX and MULTI with 1 MATRIXCOLUMN
Joel Palmius <[email protected]> Wed, 21 Nov 2007 19:29:11 +0100 (CET)
| Newsgroups | gmane.comp.apache.mod-survey.general |
|---|---|
| Message-ID | <[email protected]> |
Hrm, this is a deeper problem than just a bug with one column. It's a bit
technical, but essentially you store a submitted value in the session, and
it will remain there unless overwritten by another value. In the case of a
"normal" matrix, a value is always written, but in the case of checkboxes
a new value is only submitted if the box is checked.
I will have to think a bit on this. It is a bug very obviously, but at the
moment I see no easy fix.
For now the answer is that I doubt there is any way to avoid the bugged
behavior in the case you describe with anything less than adding a perl
snippet in the page after the matrix and clear values from the session if
they are not in the argument string.
As a work-around, you could go for a set of CHOICEs instead of a MATRIX.
// Joel
On Wed, 21 Nov 2007, Luca Notari wrote:
> Hi all,
>
> I've experienced this kind of problem, using MATRIX tag with MULTI="yes"
> attribute in multipage survey: submitted variables have values as first
> time submitted even if I go back and change them.
>
> The reason why I've used Multi is that is not possible to reset radio
> button (displayed as default for matrix) if : I have 1 column only,
> variables are submitted yet (i.e. going back with browser buttons).
>
> here an example:
>
> page1.survey
> ....
> <MATRIX NAME="my" MULTI="yes">
> <MATRIXCOLUMN CAPTION="tick" VALUE="1" />
> <MATRIXROW CAPTION="a" />
> <MATRIXROW CAPTION="b" />
> <MATRIXROW CAPTION="c" />
> </MATRIX>
> <ROUTE CONTINUE=page2.survey/>
>
>
> page2.survey
> ...
> for ($i=1; $i<=3; $i++) {
> $n="0".$i;
> print $session->getValue("SUBMITTED_my$n")
> }
> ...
>
> if, for the first time, i select a,b,c in page1 then go to page 2,
> variables are 1,1,1 ; OK. But if I go back, unselect a, unselect b,
> then go again to page2 variables are still 1,1,1, and not -1,-1,1 .
>
> If I don't use MULTI attr , the problem doesn't exists , but because if
> i go back I can't de-select radio buttons .
>
> Is there any possibility to use MULTI with 1 column only?
>
> thanks,
>
> Luca Notari
>
Skickat av Joel Palmius <[email protected]>
till survey-discussion