Re: Conditional "Must Answer" question
Joel Palmius <[email protected]> Mon, 7 Mar 2005 11:38:32 +0100 (CET)
| Newsgroups | gmane.comp.apache.mod-survey.general |
|---|---|
| Message-ID | <[email protected]> |
The reason why this doesn't work is because the MUSTANSWER parameter isn't
a part of the *visible* output. The visible output is what is printed to
the used in the question part.
There is currently no syntactically clean way to do this.
However, if you take a peek on the "redirection on submit" thread, it is
conceivable that something similar could be done for the MUSTANSWER
parameter. With a perl snippet you can dynamically change a property of
a question.
If you want to change the setting of MUSTANSWER on the first question on a
page, the corresponding perl snippet code would be:
$document->SetTagParam(1,"MUSTANSWER","no");
(Possibly it should be 0, I don't remember if questions are numbered from
0 or 1. :-) ).
I hope this helps you. Otherwise, I'll make a more complete example later
on.
// Joel
On Sat, 5 Mar 2005, George Clark wrote:
>
> Hi all,
>
> Is there any way to conditionally supply the value of "MUSTANSWER=" during
> submit processing?
>
> It seems like a simple situation. I don't want to go to a multiple page
> survey, but I'd like one or two questions to be optional based upon an earlier
> question on the same page. (I've also tried it by passing the variable from the
> prior page, but that doesn't seem to work either.
>
> I guess the manual "References to variable answers submitted on an earlier page
> can be inserted in all visible output," really means what it says about visible
> output. <g> Is there any easy way to accomplish this?
>
> <CHOICE NAME="flying" CAPTION="Are flying or riding along?" MUSTANSWER="yes"
>>
> <CHOICEELEMENT VALUE="0" CAPTION="Pilot Flying, no empty seats " />
> <CHOICEELEMENT VALUE="1" CAPTION="Pilot Flying, have seats available" />
> <CHOICEELEMENT VALUE="2" CAPTION="Passenger - I need a ride" />
> </CHOICE>
>
> <TEXT NAME="aircra" MAXLEN="15" CAPTION="Aircraft Type"
> MUSTANSWER={!flying/0:"yes",1:"yes",2:"no"!} />
> <TEXT NAME="speed" NUMERICAL="yes"
> MUSTANSWER={!flying/0:"yes",1:"yes",2:"no"!} CAPTION="Cruise Speed" />
> <TEXT NAME="seats" NUMERICAL="yes" MUSTANSWER={!flying/0:"no",1:"yes",2:"no"!}
>
> Thanks,
> George Clark
> Skickat av "George Clark" <[email protected]>
> till survey-discussion
>
Skickat av Joel Palmius <[email protected]>
till survey-discussion