mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-27 01:25:52 -05:00
Check for empty phone number on submit
Thanks @rschamp!
This commit is contained in:
parent
56481c797e
commit
56e88685b5
1 changed files with 9 additions and 1 deletions
|
@ -397,6 +397,14 @@ module.exports = {
|
||||||
waiting: false
|
waiting: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
onValidSubmit: function (formData, reset, invalidate) {
|
||||||
|
if (!formData.phone || formData.phone.national_number === '+') {
|
||||||
|
return invalidate({
|
||||||
|
'phone': this.props.intl.formatMessage({id: 'teacherRegistration.validationPhoneNumber'})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return this.props.onNextStep(formData);
|
||||||
|
},
|
||||||
render: function () {
|
render: function () {
|
||||||
var formatMessage = this.props.intl.formatMessage;
|
var formatMessage = this.props.intl.formatMessage;
|
||||||
return (
|
return (
|
||||||
|
@ -410,7 +418,7 @@ module.exports = {
|
||||||
tipContent={formatMessage({id: 'registration.nameStepTooltip'})} />
|
tipContent={formatMessage({id: 'registration.nameStepTooltip'})} />
|
||||||
</p>
|
</p>
|
||||||
<Card>
|
<Card>
|
||||||
<Form onValidSubmit={this.props.onNextStep}>
|
<Form onValidSubmit={this.onValidSubmit}>
|
||||||
<PhoneInput label={formatMessage({id: 'teacherRegistration.phoneNumber'})}
|
<PhoneInput label={formatMessage({id: 'teacherRegistration.phoneNumber'})}
|
||||||
name="phone"
|
name="phone"
|
||||||
defaultCountry={this.props.defaultCountry}
|
defaultCountry={this.props.defaultCountry}
|
||||||
|
|
Loading…
Reference in a new issue