I am having a problem with popup-menus.  Basically I have an application 
which first displays my popups with a default value of 'null' on the first 
page.  I then save these to a hidden field.  On a later page I call the 
same routine with values I have retrieved from a database and display the 
values.  All values in the popup fields display correctly - except for the 
last popup encountered in the loop.  That value is displayed as 'null'.  I 
have checked the values from the database that are fed to that popup menu -
- they are correct.  The popup is given a value which is not null.  I have 
eliminated the last popup field from the array which is fed to the loop.  
What happens is that the new last popup displays 'null'. 

Any ideas as to what is going on?

Here is the offending loop.  And yes, in order to get this to display 
properly I set override to 1 and set both the value and the default to be 
what I wish to display.  The popups were initialized with a default 
of 'null', but it is only the last one through the loop which 
displays 'null' when it has properly been given a non null value.

Maybe this is a CGI.pm bug????




   foreach $rowCount  (0..(@rptEntityValuesArray + $MaxNumberRepeats - 1)){
        if ($rowCount < @rptEntityValuesArray){
                @rptEntityValues = @{$rptEntityValuesArray[$rowCount]};
        } 
        else {
                @rptEntityValues = ();
        }               
        @tdArgs = ();
        foreach $fieldCount  (0..$columnCount - 1){
                $fieldValue = ($IsNewRecord  or [EMAIL PROTECTED]) ? q{} : 
$rptEntityValues[$fieldCount];
                if (!$fieldValue) {$fieldValue = q{}};
                $fieldName = $fieldNames[$fieldCount].$rowCount;
                $fieldType = $fieldTypes[$fieldCount];
                if ($fieldType eq 'TF') {
                        push(@tdArgs, td(textfield(-name=>$fieldName,
                                                   -default=>$fieldValue,
                                                   -value=>$fieldValue, 
                                                   -size=> $fieldSizes
[$fieldCount],
                                                   -override=>1)));
               }   
               if ($fieldType eq 'PP'){
                        @fieldList = split ',', $fieldListValues
[$fieldCount];
                        if (!$fieldValue) {
                                $fieldValue = 'null'; 
                        }       
                        push(@tdArgs, td(popup_menu(-name=>$fieldName, 
                                                -values => [EMAIL PROTECTED], 
                                                -default => $fieldValue,
                                                -override=>1)));
                }
                if ($fieldType eq "TA") {
                        push(@tdArgs, td(textarea(-name=>$fieldName, 
                                                  -value=>$fieldValue,
                                                  -default=>$fieldValue,
                                                  -rows => $fieldRows
[$fieldCount], 
                                                  -columns => $fieldColumns
[$fieldCount],
                                                  -override=>1)));
                }

        }
        $row = TR(@tdArgs);
        push @rows, $row;
   }
   print table (@rows);


Thanks
Mary Anderson

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to