react-bootstrap-datetimepicker icon indicating copy to clipboard operation
react-bootstrap-datetimepicker copied to clipboard

If i have multiple datepicker on a page, how do i get value of each ?

Open aaronucsd opened this issue 9 years ago • 2 comments

Is there a way to set an id for each datepicker on a page? Or how do i get the value of each?

aaronucsd avatar Dec 04 '15 19:12 aaronucsd

@aaronucsd You can do it like this

// in render() method:
<DateTimeField ref="myFirstDate" />
<DateTimeField ref="mySecondDate" />
// somewhere else (in the same component)
this.refs.myFirstDate.getValue();
this.refs.mySecondDate.getValue();

sebastiancarlsson avatar Dec 15 '15 10:12 sebastiancarlsson

Thanks! On Dec 15, 2015 2:18 AM, "Sebastian Carlsson" [email protected] wrote:

@aaronucsd https://github.com/aaronucsd You can do it like this

// in render() method:<DateTimeField ref="myFirstDate" /><DateTimeField ref="mySecondDate" />// somewhere else (in the same component)this.refs.myFirstDate.getValue();this.refs.mySecondDate.getValue();

— Reply to this email directly or view it on GitHub https://github.com/quri/react-bootstrap-datetimepicker/issues/138#issuecomment-164713551 .

aaronucsd avatar Dec 15 '15 16:12 aaronucsd