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.

Getting the value that was entered into the input initially

See original GitHub issue

I am trying to get the original value that the user types into the input. I have found valueBeforeUpDown in the state which looks to be exactly what I need but I don’t see any documentation around it. Is valueBeforeUpDown or a similar property available to use or is it a part of private api? I personally need this value for onSuggestionSelected and I can make a PR to add this value to the meta values object if need be.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
plee-nmcommented, Jun 28, 2018

@aarondack I actually got it working with the valueBeforeUpDown property I just didn’t see it documented and wanted to know if I could add it to onSuggestionSelected.

0reactions
aarondackcommented, Jun 27, 2018

@plee-nm

Gotcha that makes a ton of sense. You can pass arbitrary props within inputProps. My suggestion to you would be to pass in an onKeyUp within inputProps and then have logic around the arrow keys to get your desired result. I still believe this is something that can be handled outside the scope of this lib. Maybe something like this?


const inputProps = {
      placeholder: "Type 'c'",
      value,
      onChange: this.onChange,
      onKeyUp: this.onKeyUp
    };

onKeyUp = (e) => {
 if (e.keyCode !== 38 && e.keyCode !== 40) { //Or whatever you need exactly (13, etc)
	// Do something with event.target.value
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I get the value of text input field using JavaScript?
There are various methods to get an input textbox value directly (without wrapping the input element inside a form element):. Method 1. document....
Read more >
How to get the value of text input field using JavaScript
The value attribute specifies the initial value of the Input Text Field. It contains the default value or the user types. Syntax: Get...
Read more >
How to Get an Input's Value with JavaScript - Tabnine Academy
Get the value of a text input. Here is a basic example. It creates a text input field, then prints the contents to...
Read more >
How to Get the Value of Text Input Field Using ... - W3docs
Read this tutorial and learn about several methods of getting the value of the input textbox value without wrapping the input element inside...
Read more >
HTML input value Attribute - W3Schools
An HTML form with initial (default) values: ... "image" - it defines the value associated with the input (this is also the value...
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