Survey sections now have logical section type, which is never shown to the user, only used for silently checking gotos.
This commit is contained in:
parent
e25094a16e
commit
54063ae9f6
5 changed files with 21 additions and 2 deletions
|
|
@ -439,6 +439,7 @@ sub recordResponses {
|
|||
# We want to record responses against the "next" response section and questions, since these are
|
||||
# the items that have just been displayed to the user.
|
||||
my $section = $self->nextResponseSection();
|
||||
|
||||
my @questions = $self->nextQuestions();
|
||||
|
||||
#GOTO jumps in the Survey. Order of precedence is Answer, Question, then Section.
|
||||
|
|
@ -461,7 +462,7 @@ sub recordResponses {
|
|||
}
|
||||
|
||||
# Handle empty Section..
|
||||
if ( !@questions ) {
|
||||
if ( !@questions and !$section->{logical}) {
|
||||
# No questions to process, so increment lastResponse and return
|
||||
$self->lastResponse( $self->nextResponse );
|
||||
return [ $sTerminal, $terminalUrl ];
|
||||
|
|
@ -556,13 +557,18 @@ sub recordResponses {
|
|||
|
||||
# If all required responses were given, proceed onwards!
|
||||
if ($allRequiredQsAnswered) {
|
||||
|
||||
# Move the lastResponse index to the last question answered
|
||||
$self->lastResponse( $self->lastResponse + @questions );
|
||||
|
||||
# Do any requested branching..
|
||||
$self->processGoto($goto) if ( defined $goto ); ## no critic
|
||||
$self->processGotoExpression($gotoExpression) if ( defined $gotoExpression ); ## no critic
|
||||
|
||||
# Handle next logic Section..
|
||||
my $section = $self->nextResponseSection();
|
||||
if($section and $section->{logical}){
|
||||
return $self->recordResponses({});
|
||||
}
|
||||
}
|
||||
else {
|
||||
# Required responses were missing, so we don't let the Survey terminate
|
||||
|
|
|
|||
|
|
@ -882,6 +882,7 @@ sub newSection {
|
|||
questionsPerPage => 5,
|
||||
questionsOnSectionPage => 1,
|
||||
randomizeQuestions => 0,
|
||||
logical => 0,
|
||||
everyPageTitle => 1,
|
||||
everyPageText => 1,
|
||||
terminal => 0,
|
||||
|
|
@ -1222,6 +1223,9 @@ sub validateSurvey{
|
|||
push @messages, "Section $sNum variable name $var is re-used in $count other place(s).";
|
||||
}
|
||||
}
|
||||
if($section->{logical} and @{$self->questions([$s])} > 0){
|
||||
push @messages, "Section $sNum is a logical section with questions. Those questions will never be shown.";
|
||||
}
|
||||
|
||||
#step through each question validating it.
|
||||
my $questions = $self->questions([$s]);
|
||||
|
|
|
|||
|
|
@ -39,6 +39,14 @@ our $I18N = {
|
|||
message => q|Continue|,
|
||||
lastUpdated => 1224686319
|
||||
},
|
||||
'logical section' => {
|
||||
message => q|Logical Section|,
|
||||
lastUpdated => 1224686319
|
||||
},
|
||||
'logical section help' => {
|
||||
message => q|A logical section, or its questions, are never shown. They are used to silently execute jump commands.|,
|
||||
lastUpdated => 1224686319
|
||||
},
|
||||
'add section' => {
|
||||
message => q|Add Section|,
|
||||
lastUpdated => 1224686319
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue