- I am new to redux form.
- I am trying to enable the button after I click the radio button.
- to enable the go to next step button I tried setting up state and created new onclick method in the radio button.
- but still its throwing an error,
- not sure how to pass the radio button values to enable the button.
- Can you tell me how to fix it, so that in future I will fix it myself.
- Providing my sandbox and relevant code snippet below.
update1: now only this error has been removed https://codesandbox.io/s/4jpkk394x7?moduleview=1
https://codesandbox.io/s/pjj6m1l9pq
AsyncValidationForm.js
const AsyncValidationForm = props => {
console.log("AsyncValidationForm ---->");
const { handleSubmit, pristine, reset, submitting } = props;
// this.state = {
// disabled: false
// };
// this.setState({ disabled: !this.state.disabled });
const passRadioValue = (e) =>{
}
return (
<form onSubmit={handleSubmit}>
<Field
name="username"
type="text"
component={renderField}
label="Username"
/>
<Field
name="password"
type="password"
component={renderField}
label="Password"
/>
<label>
<Field name="sex"
component={renderField} type="radio" value="male"
onClick={this.passRadioValue("right")} />{" "}
Male
</label>
<div>
<button type="submit" disabled={submitting}>
Sign Up
</button>
<button type="button" disabled={pristine || submitting} onClick={reset}>
Clear Values
</button>
</div>
</form>
);
};
StepTemplate.js
<Button
variant="contained"
color="primary"
onClick={onNext}
className={classes.button}
>
{canGoBack ? "Next" : "go to next step"}
</Button>
from enable the go to next step button, tried setting up state and created new onclick method in the radio button
No comments:
Post a Comment