@@ -411,22 +411,20 @@ sub setMessage {
411
411
# #####################################################################
412
412
413
413
#
414
- # Produce the name for a named answer blank
415
- # (Use the standard name for the first one, and
416
- # create the prefixed names for the rest.)
414
+ # Produce the name for a named answer blank.
415
+ # (When the singleResult option is true, use the standard name for the first
416
+ # one, and create the prefixed names for the rest.)
417
417
#
418
418
sub ANS_NAME {
419
- my $self = shift ; my $i = shift ; my $name ;
419
+ my $self = shift ; my $i = shift ;
420
+ return $self -> {answerNames }{$i } if defined ($self -> {answerNames }{$i });
420
421
if ($self -> {singleResult }) {
421
- if (!$self -> {id }) {
422
- $name = $self -> {answerName } = main::NEW_ANS_NAME();
423
- $self -> {id } = $answerPrefix .$name ;
424
- }
425
- $name = $self -> {id }." _" .$i unless $i == 0;
422
+ $self -> {answerNames }{0 } = main::NEW_ANS_NAME() unless defined ($self -> {answerNames }{0 });
423
+ $self -> {answerNames }{$i } = $answerPrefix .$self -> {answerNames }{0 }." _" .$i unless $i == 0;
426
424
} else {
427
- $name = main::NEW_ANS_NAME();
425
+ $self -> { answerNames }{ $i } = main::NEW_ANS_NAME();
428
426
}
429
- return $name ;
427
+ return $self -> { answerNames }{ $i } ;
430
428
}
431
429
432
430
#
@@ -453,7 +451,7 @@ sub ans_rule {
453
451
if ($self -> {singleResult } && $self -> {part } > 1) {
454
452
my $extension_ans_rule =
455
453
$data -> named_ans_rule_extension(
456
- $name ,$size , answer_group_name => $self -> {answerName },
454
+ $name ,$size , answer_group_name => $self -> {answerNames }{ 0 },
457
455
@_ );
458
456
# warn "extension rule created: $extension_ans_rule for ", ref($data);
459
457
return $extension_ans_rule ;
@@ -474,12 +472,12 @@ sub ans_array {
474
472
if ($self -> {singleResult } && $self -> {part } == 1) {
475
473
my $label = main::generate_aria_label($answerPrefix .$name ." _0" );
476
474
return $data -> named_ans_array($name ,$size ,
477
- answer_group_name => $self -> {answerName },
475
+ answer_group_name => $self -> {answerNames }{ 0 },
478
476
@_ ,aria_label => $label );
479
477
}
480
478
if ($self -> {singleResult } && $self -> {part } > 1) {
481
479
$HTML = $data -> named_ans_array_extension($self -> NEW_NAME($name ),$size ,
482
- answer_group_name => $self -> {answerName }, @_ );
480
+ answer_group_name => $self -> {answerNames }{ 0 }, @_ );
483
481
# warn "array extension rule created: $HTML for ", ref($data);
484
482
} else {
485
483
$HTML = $data -> named_ans_array($name ,$size ,@_ );
0 commit comments