Bug 20682

Summary: Authorised values should have an option to set a default
Product: Koha Reporter: Hugh Rundle <hughr>
Component: System AdministrationAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: caroline.cyr-la-rose, gmcharlt, lisettepalouse+koha, m.de.rooy, Niamh.WalkerHeadon
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14662
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:

Description Hugh Rundle 2018-04-30 03:38:08 UTC
There are many places in Koha where values can be chosen via a drop-down menu listing a particular authorised value. For example SUGGEST_FORMAT is used to populate the list of formats that can be selected when placing a purchase suggestion. Currently these lists appear in alphabetical order by description or OPAC description (depending on context), and the first option in the list is usually auto-selected (i.e. more or less default behaviour for a vanilla HTML <select> element). This is problematic in many circumstances as users will accidentally 'select' the first alphabetical option if they don't change anything.

There should be a setting in Authorised Values to set between zero and one values per category to be the default value (probably in authorised_values.pl?op=add_form). This would then add a 'selected' attribute to the <option> tag wherever the authorised value list appears as a dropdown menu.
Comment 1 Marcel de Rooy 2022-09-15 09:02:03 UTC
(In reply to Hugh Rundle from comment #0)
> There are many places in Koha where values can be chosen via a drop-down
> menu listing a particular authorised value. For example SUGGEST_FORMAT is
> used to populate the list of formats that can be selected when placing a
> purchase suggestion. Currently these lists appear in alphabetical order by
> description or OPAC description (depending on context), and the first option
> in the list is usually auto-selected (i.e. more or less default behaviour
> for a vanilla HTML <select> element). This is problematic in many
> circumstances as users will accidentally 'select' the first alphabetical
> option if they don't change anything.

Good observation.
 
> There should be a setting in Authorised Values to set between zero and one
> values per category to be the default value (probably in
> authorised_values.pl?op=add_form). This would then add a 'selected'
> attribute to the <option> tag wherever the authorised value list appears as
> a dropdown menu.

Not sure if we should address it like that. You might have two columns using one AV category where one column may be NULL and the other one not.

"This would add a selected attribute" => That might be a lot of work checking all templates.. Probably address the most striking cases first?
Comment 2 Marcel de Rooy 2022-09-15 09:04:05 UTC
About the select. Found this on stackoverflow:

<select>
    <option style="display:none;"></option>
    <option>Option 1</option>
[etc]

OR

<select class="first-opt-hidden">
    <option></option>
    <option>Option 1</option>
[etc]
WITH css:
select.first-opt-hidden option:first-of-type {
  display:none;
}
Comment 3 Niamh Walker-Headon 2023-02-14 13:47:15 UTC
The select option might work, but coding could get lost at upgrade stage, so I think it would be better to have the option to set a default value.