-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Improve Documentation for Forms #1850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
you can just use findDOMNode on the component to get the underlying input |
The switch from the old Input to Form Controls has many downsides. This being just one more. |
|
I understand that we can now use I only knew to make this change in my projects because I found these issues. I think it would be better to leave this open until documentation for explaining this is added, unless of course we expect people to just assume this is what they need to do from now on. |
PRs Welcome! we'll happily take a doc improveent |
I still dont see any end-to-end examples of how to work with values in FormGroups. You mention using findDOMNode but I don't quit understand how to do this easily. this jsfiddle is probably the most example code I found on the net and it works with inputs directly: I think I might just have to rewrite everything with plain . |
@chalda there is nothing special to be done about managing values, the FormControl's are just wrappers around the plain inputs, so you do the same things to manage values as you would plain inputs |
Hi! first of all thanks to everyone who contributed to this project. It's an enormous help for people trying to bust out apps world wide I think. I'm now converting an old codebase to a new version of this, and I'm changing all the I've never worked with It would be highly beneficial for me for the documentation to include small code examples how "how to get stuff done", and in my experience leaving things implied will always get some reader/user in trouble down the line :-) |
I am having problem while performing unit tests with enzyme. How would you accesss the |
Could a kind soul please provide a working code example? |
There are multiple working examples on the components page. |
For those saying that they don't know what
Example Usagevar React = require("react");
var ReactDOM = require("react-dom");
var FormControl = require("react-bootstrap").FormControl;
React.createClass({
render: function() {
return (<FormControl ref = 'formControl'/>);
},
getFormControlNode: function() {
return ReactDOM.findDOMNode(this.refs.formControl);
}
}); |
Apologies, I was unclear. The code example I would greatly appreciate, is one which demonstrates the alternative to this.refs and .getValue(). Thanks :) |
@nadeemja you use refs and |
Clarifying the docs a bit more in #2077. |
Is there any way that we can do this with the callback syntax: https://facebook.github.io/react/docs/refs-and-the-dom.html#the-ref-callback-attribute I get the below errors with the latest eslint.
|
NOTE: This is not passing rspec See react-bootstrap/react-bootstrap#1850
@justin808 You can use the same callback syntax as you would with a normal input. The wrappers are meant to be lightweight! So you can just put an onChange callback on it. |
NOTE: This is not passing rspec See react-bootstrap/react-bootstrap#1850
I'm a bit unclear on how to get the value of a My component with the ref looks like this;
And I want to use the value of the input here;
I don't see anything in the It looks like we need a way to pass a callback ref into the |
Folks, there is now a ton of documentation and pass issues where getting and setting the values of form inputs is covered extensively. Follow up comments on this and other related issues only serve to ping a bunch of people unnecessarily. Our stance on on this API has been clear from the start here. The correct way to get values from inputs, is to use controlled inputs. For those don't want to/can't use idiomatic React patterns, we we aren't inventing an interface to native DOM elements when React already provides two. I still have no problem recommending using |
Uh oh!
There was an error while loading. Please reload this page.
I can't see in the Docs a good alternative to:
How can a value be obtained from the
<FormControl/>
component?The text was updated successfully, but these errors were encountered: