Skip to content

Buggy dropdown won't close properly and doesn't set value correctly sometimes #1155

@emitlinks

Description

@emitlinks

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

GLPI Version

11.0.5

Plugin version

1.23.3

Bug description

When selecting a value in any dropdown (not necessary the custom fields dropdown) of an item with custom fields the dropdown get buggy and doesn't close because of a javascript error.

While debugging I found out that it's the refreshContainer function that fail when the function get multiple_matches and that the current field that matched has an empty string value.

Example with groups_id_tech :
Image

A fix would be to add a check to see if the value is an empty string at this line so it would create an empty array in this case which would make the push method works a few line after :

if (!(name in obj)) {

Relevant log output

Uncaught TypeError: obj[name].push is not a function
    at <anonymous>:13:39
    at Array.reduce (<anonymous>)
    at refreshContainer (<anonymous>:5:104)
    at HTMLSelectElement.<anonymous> (<anonymous>:75:29)
    at HTMLFormElement.dispatch (base.min.js?v=af270aae27c4d597be591a74861f215576327064:11:41760)
    at v.handle (base.min.js?v=af270aae27c4d597be591a74861f215576327064:11:39643)
    at Object.trigger (base.min.js?v=af270aae27c4d597be591a74861f215576327064:11:73967)
    at HTMLSelectElement.<anonymous> (base.min.js?v=af270aae27c4d597be591a74861f215576327064:11:74602)
    at A.each (base.min.js?v=af270aae27c4d597be591a74861f215576327064:11:3080)
    at obj.<computed>.each (base.min.js?v=af270aae27c4d597be591a74861f215576327064:11:1458)

Page URL

No response

Steps To reproduce

  1. Set custom fields on an itemtype
  2. Set fields which can get multiples values (like groups) with a value
  3. Try to set the value of a dropdown (the bug should happen instantly and the js error appears in the browser console)

Your GLPI setup information

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions