Last active
June 16, 2016 10:34
-
-
Save shicky/6a34c7637556dde6016f7bfe194aac21 to your computer and use it in GitHub Desktop.
Handling checkbox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Form = require('react-bootstrap/lib/Form'); | |
const FormGroup = require('react-bootstrap/lib/FormGroup'); | |
const FormControl = require('react-bootstrap/lib/FormControl'); | |
const Col = require('react-bootstrap/lib/Col'); | |
const ControlLabel = require('react-bootstrap/lib/ControlLabel'); | |
onChangeValue(evt, check=false) { | |
this.setState({[evt.target.id]: check?evt.target.checked:evt.target.value}); | |
}, | |
return ( | |
<Form> | |
<FormGroup controlId="name"> | |
<Col componentClass={ControlLabel} sm={2}> | |
Name | |
</Col> | |
<Col sm={10}> | |
<FormControl type="text" placeholder="Enter Name" value={this.state.name} onChange={this.onChangeValue} /> | |
</Col> | |
</FormGroup> | |
<FormGroup controlId="enabled"> | |
<Col componentClass={ControlLabel} sm={2}> | |
Enabled | |
</Col> | |
<Col sm={10}> | |
<FormControl type="checkbox" placeholder="Enter Comma-Separated Numbers" value={this.state.port_scan} onChange={this.onChangeValue} /> | |
</Col> | |
</FormGroup> | |
</Form> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment