NewOldMax / react-form-validator-core

Core validator component for react forms
MIT License
95 stars 44 forks source link

Not able to detect if input is dirty or touched and also not possible to disable submit button #39

Closed ARKKYN closed 5 years ago

ARKKYN commented 5 years ago

@NewOldMax It is not able to detect if form is dirty or touched and feature to make it dirty by function

NewOldMax commented 5 years ago

For my opinion it's you app logic to check if input is touched or disable submit button on some conditions. This library is only validates value, prevent form submitting if validation fails and give you validation result

class MyForm extends React.Component {
    state = {
        touched: false,
    }

    handleTouch = () => {
        this.setState({ touched: true });
    }

    render() {
        return (
            <TextValidator
                onBlur={this.handleTouch} // or onChange, whatever you need
             />
        );
    }
}