1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 17:45:10 +01:00
onion/js/components/ascribe_forms/input_hidden.js

39 lines
894 B
JavaScript
Raw Normal View History

'use strict';
2015-06-01 13:02:53 +02:00
import React from 'react';
import AlertMixin from '../../mixins/alert_mixin';
2015-06-01 13:02:53 +02:00
let InputHidden = React.createClass({
propTypes: {
submitted: React.PropTypes.bool,
value: React.PropTypes.string
},
2015-06-01 13:02:53 +02:00
mixins: [AlertMixin],
2015-06-01 13:02:53 +02:00
getInitialState() {
return {value: this.props.value,
alerts: null // needed in AlertMixin
};
},
handleChange(event) {
this.setState({value: event.target.value});
},
render() {
let alerts = (this.props.submitted) ? null : this.state.alerts;
return (
<div className="form-group">
{alerts}
<input
value={this.props.value}
type="hidden"
onChange={this.handleChange}
/>
</div>
);
}
});
export default InputHidden;