--- loncom/interface/loncommon.pm 2025/03/17 00:25:51 1.1470 +++ loncom/interface/loncommon.pm 2025/03/18 18:57:28 1.1471 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.1470 2025/03/17 00:25:51 raeburn Exp $ +# $Id: loncommon.pm,v 1.1471 2025/03/18 18:57:28 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2800,7 +2800,7 @@ sub create_text_file { # ------------------------------------------ sub domain_select { - my ($name,$value,$multiple,$incdoms,$excdoms)=@_; + my ($name,$value,$multiple,$incdoms,$excdoms,$id)=@_; my @possdoms; if (ref($incdoms) eq 'ARRAY') { @possdoms = @{$incdoms}; @@ -2821,10 +2821,10 @@ sub domain_select { if ($multiple) { $domains{''}=&mt('Any domain'); $domains{'select_form_order'} = [sort {lc($a) cmp lc($b) } (keys(%domains))]; - return &multiple_select_form($name,$value,4,\%domains); + return &multiple_select_form($name,$value,4,\%domains,undef,$id); } else { $domains{'select_form_order'} = [sort {lc($a) cmp lc($b) } (keys(%domains))]; - return &select_form($name,$value,\%domains); + return &select_form($name,$value,\%domains,'','',$id); } } @@ -2836,7 +2836,7 @@ sub domain_select { =over 4 -=item * &multiple_select_form($name,$value,$size,$hash,$order) +=item * &multiple_select_form($name,$value,$size,$hash,$order,$id) Returns a string containing a element =cut #------------------------------------------- sub multiple_select_form { - my ($name,$value,$size,$hash,$order)=@_; + my ($name,$value,$size,$hash,$order,$id)=@_; my %selected = map { $_ => 1 } ref($value)?@{$value}:($value); my $output=''; if (! defined($size)) { @@ -2862,7 +2863,10 @@ sub multiple_select_form { $size = scalar(keys(%$hash)); } } - $output.="\n".''; my @order; if (ref($order) eq 'ARRAY') { @order = @{$order}; @@ -2886,7 +2890,7 @@ sub multiple_select_form { =pod -=item * &select_form($defdom,$name,$hashref,$onchange,$readonly) +=item * &select_form($defdom,$name,$hashref,$onchange,$readonly,$id) Returns a string containing a \n"; + if ($id ne '') { + $id = ' id="'.$id.'"'; + } + my $selectform = "\n"; + my $selectform = "