Fixed uncontrollable/controllable components in examples
This commit is contained in:
parent
1800442ea1
commit
3cdcdf57ce
|
|
@ -71,7 +71,7 @@ const DynamicInput = React.createClass({
|
|||
return (
|
||||
<div className={className}>
|
||||
<label htmlFor={this.props.name}>{this.props.title}</label>
|
||||
<input type='text' name={this.props.name} onChange={this.changeValue} value={this.getValue()}/>
|
||||
<input type='text' name={this.props.name} onChange={this.changeValue} value={this.getValue() || ''}/>
|
||||
<span className='validation-error'>{errorMessage}</span>
|
||||
<Validations validationType={this.state.validationType} changeValidation={this.changeValidation}/>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ const Fields = props => {
|
|||
field.type === 'input' ?
|
||||
(
|
||||
<MyInput
|
||||
value=""
|
||||
name={`fields[${i}]`}
|
||||
title={field.validations ? JSON.stringify(field.validations) : 'No validations'}
|
||||
required={field.required}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ const App = React.createClass({
|
|||
render() {
|
||||
return (
|
||||
<Form onSubmit={this.submit} onValid={this.enableButton} onInvalid={this.disableButton} className="login">
|
||||
<MyInput name="email" title="Email" validations="isEmail" validationError="This is not a valid email" required />
|
||||
<MyInput name="password" title="Password" type="password" required />
|
||||
<MyInput value="" name="email" title="Email" validations="isEmail" validationError="This is not a valid email" required />
|
||||
<MyInput value="" name="password" title="Password" type="password" required />
|
||||
<button type="submit" disabled={!this.state.canSubmit}>Submit</button>
|
||||
</Form>
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue