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

(cherry picked from commit ba48151)

https://bugzilla.redhat.com/show_bug.cgi?id=1702063
  • Loading branch information
martinpovolny authored and simaishi committed Apr 22, 2019
1 parent d2fea4c commit c541376
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 c541376

Please sign in to comment.