question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Set a value programatically

See original GitHub issue

Hi! I need to set a value to the Typeahead programmatically and I can’t seem to find the correct way, I used defaultValue but it does not work, any ideas?

Thanks a lot! Fran

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
yurynixcommented, Aug 10, 2015

Hi, What you guys think about something like that: https://github.com/yurynix/react-typeahead/commit/1a963818adeded7d1400e44fd521af2df4c246db

It works for my scenario, I update the value in the parent component when user clicks on some buttons. I render Typeahead like this:

        <Typeahead ref="typeahead"
         ...
          value={this.props.value}
         ...
        />
1reaction
idolizecommented, Jun 16, 2015

I would even go so far as to request the support of a valueLink prop to use with ReactLink on controlled components, but this is just nice sugar on top of support for a controlled value prop, so it isn’t necessary.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I programmatically set the value of a select box ...
You can use this function: function selectElement(id, valueToSelect) { let element = document.getElementById(id); element.value ...
Read more >
How to Programmatically Set the Value of a Select Element ...
In this article, we'll look at how to programmatically set the value of a select element with JavaScript. One way to set the...
Read more >
How to programmatically set the value of a select box element ...
We can set the value of a select box using Javascript using the following. Suppose we have the following select box −
Read more >
Set the Default Value of a Control in a VI Programmatically - NI
I would like to write some information into a control or indicator and set it as the default value without opening or running...
Read more >
ng-select How to programmatically set a value
Connect with:​​ Topic: ng-select How to programmatically set a value ? this. optionsSelect = [ { value: '1', label: 'Option 1' }, {...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found