Skip to content

Commit 6aeed81

Browse files
Merge pull request #2340 from rashmi73/issue_2094
Issue 2094 fix
2 parents a9f06c4 + 388bb48 commit 6aeed81

File tree

1 file changed

+16
-0
lines changed
  • src/shared/components/Settings/Profile/BasicInfo

1 file changed

+16
-0
lines changed

src/shared/components/Settings/Profile/BasicInfo/index.jsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ export default class BasicInfo extends ConsentComponent {
100100
let invalid = false;
101101
let errorMessage = '';
102102
let dateError = '';
103+
let zipError = '';
103104
let birthDateInvalid = false;
105+
let zipInvalid = false;
104106
const invalidFields = [];
105107

106108
if (!_.trim(newBasicInfo.firstName).length) {
@@ -123,6 +125,13 @@ export default class BasicInfo extends ConsentComponent {
123125
errorMessage += ' cannot be empty';
124126
}
125127

128+
_.forEach(newBasicInfo.addresses, (address) => {
129+
if (!(/^[0-9-]*$/.test(address.zip))) {
130+
zipError = 'You must enter a valid zip code';
131+
zipInvalid = true;
132+
}
133+
});
134+
126135
if (_.trim(newBasicInfo.birthDate).length > 0) {
127136
if (!moment().isAfter(newBasicInfo.birthDate)) {
128137
dateError = 'You must enter a valid date for Birth Date';
@@ -137,6 +146,13 @@ export default class BasicInfo extends ConsentComponent {
137146
invalid = birthDateInvalid;
138147
}
139148

149+
if (errorMessage.length > 0) {
150+
errorMessage = `${errorMessage}. ${zipError}`;
151+
} else if (zipError.length > 0) {
152+
errorMessage = zipError;
153+
invalid = zipInvalid;
154+
}
155+
140156
this.setState({ errorMessage, formInvalid: invalid });
141157
return invalid;
142158
}

0 commit comments

Comments
 (0)