Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate content for non-required fields #421

Merged
merged 1 commit into from
Sep 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/dialog-user/services/dialogData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,14 @@ export default class DialogDataService {
}
}
}
} else {
if (field.type === 'DialogFieldDateControl' ||
field.type === 'DialogFieldDateTimeControl') {
if (!(_.isDate(value) || value === null)) {
Copy link
Contributor

@himdel himdel Sep 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null is valid when not required

the code is right, my eyes are not ;)

// if value === undefined, a sting has been entered
fail(__('Select a valid date'));
}
}
}

// Run check if someone has specified a regex. Make sure if its required it is not blank
Expand Down