var MyContactForm = React.createClass({
getInitialState() {
return {
disabled: true
};
},
resetValidation() {
this.setState({
disabled: true
});
},
validationState() {
var checked = this.refs.myCheckbox.checked;
if(checked){
disabled: false
}
return { disabled };
},
handleChange() {
this.setState( this.validationState() );
},
render: function() {
return (
<form>
<Input type="text" label="Name" placeholder="Your Name" bsSize="large" />
<Input type="email" label="Email" placeholder="Your Email" bsSize="large"/>
<Input type="textarea" label="Massage" placeholder="Please tell me more" bsSize="large"/>
<RulesAndConditions>Rules and Conditions</RulesAndConditions>
<Input ref="myCheckbox" type="checkbox" label="Confirm" readOnly onChange={this.handleChange} bsSize="large"/>
<ButtonGroup vertical block>
<Button onClick={this.resetValidation} type="reset" bsStyle="warning" bsSize="large">Reset</Button>
<p/>
<Button type="submit" bsStyle="success" bsSize="large" disabled={this.state.disabled}
onChange={this.handleChange()}>Submit</Button>
<p/>
<Button ref="closeButton" onClick={this.props.onHide} bsStyle="danger" bsSize="large">Close</Button>
</ButtonGroup>
</form>
)
}
});
getInitialState() {
return {
disabled: true
};
},
resetValidation() {
this.setState({
disabled: true
});
},
validationState() {
var checked = this.refs.myCheckbox.checked;
if(checked){
disabled: false
}
},
handleChange() {
this.setState( this.validationState() );
},
<form>
<Input ref="myCheckbox" type="checkbox" label="Confirm" readOnly onChange={this.handleChange()} bsSize="large"/>
<Button type="submit" bsStyle="success" bsSize="large" disabled={this.state.disabled}
onChange={this.handleChange()}>Submit</Button>
</form>
"homepage": "https://github.com/Antibioticvz/SimpleContactFormOnClick#readme",
"dependencies": {
"babel": "^6.3.26",
"babel-preset-react": "^6.3.13",
"jsx-loader": "^0.13.2",
"react": "^0.14.6",
"react-bootstrap": "^0.28.2",
"react-dom": "^0.14.6"
},
"devDependencies": {
"babel-core": "^6.4.0",
"babel-loader": "^6.2.1",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"react-hot-loader": "^1.3.0"
}