Generate unique IDs for SettingsCheckbox

Signed-off-by: Travis Ralston <travpc@gmail.com>
This commit is contained in:
Travis Ralston 2017-10-29 22:16:46 -06:00
parent f44622b3d8
commit b139c8d01c

View file

@ -47,16 +47,16 @@ module.exports = React.createClass({
if (!label) label = SettingsStore.getDisplayName(this.props.name, this.props.level); if (!label) label = SettingsStore.getDisplayName(this.props.name, this.props.level);
else label = _t(label); else label = _t(label);
let id = this.props.name; // We generate a relatively complex ID to avoid conflicts
const id = this.props.name + "_" + this.props.group + "_" + this.props.value + "_" + this.props.level;
let checkbox = ( let checkbox = (
<input id={this.props.name} <input id={id}
type="checkbox" type="checkbox"
defaultChecked={val} defaultChecked={val}
onChange={this.onChange} onChange={this.onChange}
/> />
); );
if (this.props.group) { if (this.props.group) {
id = this.props.group + '_' + this.props.name;
checkbox = ( checkbox = (
<input id={id} <input id={id}
type="radio" type="radio"