This is a migrated thread and some comments may be shown as answers.

Multiselect - manually set name/id of component?

2 Answers 1081 Views
Wrappers for React
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 29 Aug 2019, 01:27 PM

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 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 30 Aug 2019, 07:13 AM

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
0
David
Top achievements
Rank 1
answered on 30 Aug 2019, 09:29 AM

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.

Tags
Wrappers for React
Asked by
David
Top achievements
Rank 1
Answers by
Stefan
Telerik team
David
Top achievements
Rank 1
Share this question
or