Skip to content

Commit

Permalink
Merge pull request #377 from romanblanco/bz1692736
Browse files Browse the repository at this point in the history
Corrected condition testing emptiness of dialog field
  • Loading branch information
martinpovolny authored Mar 27, 2019
2 parents 348f262 + 4cade91 commit ba48151
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/dialog-user/services/dialogData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export default class DialogDataService {
}
// Run check if someone has specified a regex. Make sure if its required it is not blank
if (field.validator_rule && validation.isValid === true) {
if (angular.isDefined(fieldValue) && fieldValue !== '') {
if (angular.isDefined(fieldValue) && !_.isEmpty(fieldValue)) {
// This use case ensures that an optional field doesnt check a regex if field is blank
const regexPattern = field.validator_rule.replace(/\\A/i, '^').replace(/\\Z/i,'$');
const regex = new RegExp(regexPattern);
Expand Down

0 comments on commit ba48151

Please sign in to comment.