Multiselect - manually set name/id of component?

3 posts, 0 answers
  1. David
    David avatar
    12 posts
    Member since:
    May 2013

    Posted 29 Aug 2019 Link to this post

    So I don't know if this is by design/mistake/overlooked but it seems multiselects do not apply the id or name property i manually set them when being rendered. 

     

    see example project here: 

    https://stackblitz.com/edit/react-kjdntt

     

     

     

    It would appear your numeric textbox control does honour these settings but i can only assume at this stage that all the dropdown based ones do not honour it. 

    (see attached image for console output)

    This is causing me some problems with a generic form validation component that I am creating where it will display the name of the control(s) that is/are invalid when the form is being submitted for not only your input controls but also standard html controls. 

     

    Am I overlooking something here or is there a design decision why this is being done in this way? 

     

     

     

     

     

     

  2. Stefan
    Admin
    Stefan avatar
    2893 posts

    Posted 30 Aug 2019 Link to this post

    Hello, David,

    Thank you for the example.

    This can be done using the ref of the component to add the desired attributes to the element:

    https://stackblitz.com/edit/react-kjdntt-kympsq?file=app/main.jsx

    The reason why we did not add it to the MultiSelect is that the MultiSelect and the other DropDowns have a wrapper element(span) and input or select element inside. If we decide to add it to the input, some users may complain that it is not added to the wrapper and the other way around. This is why for now we leave it to the developer to decide which attributes and where to add then using ref.

    Regards,
    Stefan
    Progress Telerik

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. David
    David avatar
    12 posts
    Member since:
    May 2013

    Posted 30 Aug 2019 in reply to Stefan Link to this post

    Thanks for the info.

    I am still relatively new to React (as in 3 weeks of dev time and counting) so I wasn't aware this was a thing. Knowing this makes life a lot easier.

     

    For others it may be something that is put into the documentation as an FAQ - it would certainly help out us new React Developers.

Back to Top