added sol100 and chado cvterm pages to validate_all.t
[sgn.git] / lib / CXGN / Page / Form / EditableSelect.pm
bloba0d811190ce5d2da0bba191481b67d77ce1c0ba3
2 use strict;
3 use CXGN::Page::Form::Select;
5 package CXGN::Page::Form::EditableSelect;
7 use base qw / CXGN::Page::Form::Select /;
9 =head2 new
11 Usage:
12 Desc:
13 Ret:
14 Args:
15 Side Effects:
16 Example:
18 =cut
20 sub new {
21 print STDERR "Instantiating new EditableSelect...\n";
22 my $class = shift;
23 my %args = @_;
24 #foreach my $k (keys %args) { print "Args to add_select $k, $args{$k}\n<br />"; }
25 my $self = $class->SUPER::new(%args);
27 return $self;
31 sub render {
32 my $self = shift;
33 print STDERR "Rendering Editable Select...\n";
34 my $select_id = $self->get_id();
35 my $select_name = $self->get_field_name();
36 my $box = qq { <select id="$select_id" name="$select_name"> };
37 foreach my $s ($self->get_selections()) {
38 my $yes = "";
39 #if (exists($s->[0])) { print STDERR "S0 = $s->[0]\n"; }
40 #if (exists($s->[1])) { print STDERR "S1 = $s->[1] INPUT:".($self->get_contents()). "\n"; }
42 if (exists($s->[1]) && ($s->[1]=~/\d+/) && ($s->[1] == $self->get_contents())) {
43 $yes = "selected=\"selected\"";
45 elsif (exists($s->[1]) && ($s->[1]=~/\w+/) && ($s->[1] eq $self->get_contents())) {
46 $yes = "selected=\"selected\"";
49 $box .= qq { <option value="$s->[1]" $yes>$s->[0]</option> };
52 $box .= qq { </select> };
53 return $box;
56 return 1;