Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

How to create a handler function that caters for a drop down.

$
0
0

I am creating an SPFX form and have managed to create a handler function that 'handles' multiple different text fields, but now I need a handler that can cater for multiple different drop down fields. I am using Microsoft Fabric UI.

The major issue is that for every textField a 'name' property can be called upon so the handler knows which textfield is which. A drop down doesn't have such a field. So how would I code a handler to cater for a drop down?

Here's my existing handler:

public onDropDownChange = (evt: any) => {
  const {value} = (evt.target as any);
  // const selectedItem = ((item && item.key) ? item.key.toString(): null );
  //What to put!!?
  this.setState({ 
  });
  console.log(value);
}

Any ideas on how to make a handler accept drop downs when they don't have a unique identifier like a textfield has?


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>