0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-17 23:44:39 -05:00

Removed validation check on input blur

no issue

- Removes validation check for fields on focus away to make the form behavior more friendly
This commit is contained in:
Rish 2020-10-13 11:29:48 +05:30
parent ad488d73ed
commit e591770e5e
4 changed files with 1 additions and 36 deletions

View file

@ -1,7 +1,7 @@
import React, {Component} from 'react';
import InputField from './InputField';
const FormInput = ({field, onChange, onBlur, onKeyDown = () => {}}) => {
const FormInput = ({field, onChange, onBlur = () => { }, onKeyDown = () => {}}) => {
if (!field) {
return null;
}

View file

@ -127,18 +127,6 @@ export default class AccountProfilePage extends React.Component {
});
}
handleInputBlur(e, field) {
this.setState((state) => {
const fieldErrors = ValidateInputForm({fields: this.getInputFields({state, fieldNames: [field.name]})}) || {};
return {
errors: {
...(state.errors || {}),
...fieldErrors
}
};
});
}
getInputFields({state, fieldNames}) {
const errors = state.errors || {};
const fields = [
@ -183,7 +171,6 @@ export default class AccountProfilePage extends React.Component {
fields={this.getInputFields({state: this.state})}
onChange={(e, field) => this.handleInputChange(e, field)}
onKeyDown={(e, field) => this.onKeyDown(e, field)}
onBlur={(e, field) => this.handleInputBlur(e, field)}
/>
</div>
);

View file

@ -47,14 +47,6 @@ export default class SigninPage extends React.Component {
});
}
handleInputBlur(e) {
this.setState((state) => {
return {
errors: ValidateInputForm({fields: this.getInputFields({state})})
};
});
}
onKeyDown(e) {
// Handles submit on Enter press
if (e.keyCode === 13){
@ -118,7 +110,6 @@ export default class SigninPage extends React.Component {
<InputForm
fields={this.getInputFields({state: this.state})}
onChange={(e, field) => this.handleInputChange(e, field)}
onBlur={(e, field) => this.handleInputBlur(e, field)}
onKeyDown={(e, field) => this.onKeyDown(e, field)}
/>
</div>

View file

@ -187,18 +187,6 @@ class SignupPage extends React.Component {
});
}
handleInputBlur(e, field) {
this.setState((state) => {
const fieldErrors = ValidateInputForm({fields: this.getInputFields({state, fieldNames: [field.name]})}) || {};
return {
errors: {
...(state.errors || {}),
...fieldErrors
}
};
});
}
handleSelectPlan(e, name) {
e.preventDefault();
// Hack: React checkbox gets out of sync with dom state with instant update
@ -383,7 +371,6 @@ class SignupPage extends React.Component {
<InputForm
fields={fields}
onChange={(e, field) => this.handleInputChange(e, field)}
onBlur={(e, field) => this.handleInputBlur(e, field)}
onKeyDown={(e, field) => this.onKeyDown(e, field)}
/>
{this.renderPlans()}