[Koha-devel] Wierd bug in addbiblio.pl

Silva, Ernesto - Webmaster silva at ort.edu.uy
Fri Aug 5 13:06:03 CEST 2005


Hi Paul,

	I've solved the problem (I think), I haven't wrote a new function, 
instead I added one extra parameter to the scrolling_list call in 
add_biblio.pl.

It was:
	$output = CGI::scrolling_list( -name     => 'field_value',
                 -values   => \@authorised_values,
                 -labels   => \%authorised_lib,
                 -size    => 1,
                 -multiple => 0 );

Now is:
	$output = CGI::scrolling_list( -name     => 'field_value',
                 -values   => \@authorised_values,
                 -labels   => \%authorised_lib,
                 -override => 1,
                 -size    => 1,
                 -multiple => 0 );

	WATCH THE "-override => 1,"  PARAMETER!!!!

NOTE: scrolling_list is called twice, don't forget to change both of them.

I'm not sending you the diff result because we've made other modifications.
	


And from the 'man CGI':

----------------------------------------------------------------
CREATING FILL-OUT FORMS:
        General note  The various form-creating methods all return 
strings to
        the caller, containing the tag or tags that will create the 
requested
        form element.  You are responsible for actually printing out these
        strings.  It's set up this way so that you can place formatting tags
        around the form elements.

        Another note The default values that you specify for the forms 
are only
        used the first time the script is invoked (when there is no query
        string).  On subsequent invocations of the script (when there is a
        query string), the former values are used even if they are blank.

        If you want to change the value of a field from its previous 
value, you
        have two choices:

        (1) call the param() method to set it.

        (2) use the -override (alias -force) parameter (a new feature in 
ver-
        sion 2.15).  This forces the default value to be used, regardless of
        the previous value:

           print $query->textfield(-name=>'field_name',
                                   -default=>'starting value',
                                   -override=>1,
                                   -size=>50,
                                   -maxlength=>80);

----------------------------------------------------------------


Finally, there are a lot of other scripts that call CGI::scrolling_list, 
I'll take a look at them (additem.pl?) but I probably won't send the 
patches to the list since as I said before, we've made many 
modifications, so the diff output is more dirty than needed.

Regards,
	Ernesto.





















Paul POULAIN wrote:
> Silva, Ernesto - Webmaster a écrit :
> 
>> Hi Paul,
>>     last night I was thinking the solution is then one you proposed. 
>> If we (Andres and I) build a new function to substitute 
>> CGI::scrolling_list, must we reproduce it exactly (same parameters) or 
>> just make a similar one that fills our needs?
>>
>> What do you want? ;)
> 
> 
> the best would be to reproduce it exactly, with the same parameters. And 
> maybe send a bugreport or query to CGI packager.
> 
>> I'm asking this because our librarians are very "nervous" about it so 
>> we need to solve it this week (today or tomorrow).
>>
>> Ah, I forgot, in which module do we include the function? Koha.pm 
>> perhaps?
> 
> 
> 
> C4/Interface/CGI/Output.pm is probably the best place.
> 




More information about the Koha-devel mailing list