You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 23, 2022. It is now read-only.
The text was updated successfully, but these errors were encountered:
ajaykumar6
changed the title
Enable the submit button only when the form is filled
Enable the submit button only when the form is filled-how to do it
Sep 25, 2018
ajaykumar6
changed the title
Enable the submit button only when the form is filled-how to do it
Enable the submit button only when the form is filled(react form)-how to do it
Sep 25, 2018
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
import React from "react";
import ReactDOM from "react-dom";
import "./styles.css";
class App extends React.Component {
constructor(props) {
super(props);
}
handleValidation() {
let fields = this.state.fields;
let errors = {};
let formIsValid = true;
}
contactSubmit(e) {
e.preventDefault();
if (this.handleValidation()) {
alert("Form submitted successfully");
} else {
alert("Form has errors.");
}
}
handleChange(field, e) {
let fields = this.state.fields;
fields[field] = e.target.value;
this.setState({ fields });
}
render() {
return (
<input
ref="name"
type="text"
size="30"
placeholder="Enter UserName"
onChange={this.handleChange.bind(this, "name")}
value={this.state.fields["name"]}
/>
}
}
const rootElement = document.getElementById("root");
ReactDOM.render(, rootElement);
The text was updated successfully, but these errors were encountered: