[ic] Selecting an empty file in an image list popup menu

David Christensen david at endpoint.com
Thu Jun 28 11:13:25 EDT 2007


Greets,

We have a client managing a table through the table editor who needs  
to be able to select and deselect images from the IC admin using the  
standard image list popup menu.  Selecting '(none)' as the choice  
from the image popup does not unset the chosen image.

I have identified the area of code in Vend/Data.pm (IC 5.3.2) which  
needs to be changed, but I don't
know how to make it not an ugly hack.

Starting at about line 2071:

unless (length($dref->[0])) {
     # no need for a file update

     if($file_oldfiles[$i]) {
         $dref->[0] = $file_oldfiles[$i];
     }
     else {
         $skip_for_now{$nm} = 1;
     }
     next;
}

If you comment out the line that sets the $skip_for_now, you can  
switch the <select> to the (none) entry and it allows you to unselect  
the values for the pulldown menu, so I believe that this is the  
appropriate area of code to change.

I suspect the problem truly comes from the fact that the '(none)'  
selection has value ''.  We could either change the if() check to  
allow for some new sentinal value and change the corresponding  
<select> generation code, or somehow switch on the field type, if it  
is available in a non-convoluted fashion.

Thoughts/existing solutions?  This seems like something that someone  
would have come across and solved already.

Regards,

David Christensen
--
David Christensen
End Point Corporation
david at endpoint.com





More information about the interchange-users mailing list