Skip to content
This repository has been archived by the owner on Aug 3, 2022. It is now read-only.

Commit

Permalink
[#829] Add validator for Source question
Browse files Browse the repository at this point in the history
This special rule checks that each Source URL is a valid URL for the
location quesiton which uses `QuestionFieldSource` question type.
  • Loading branch information
brew committed Nov 25, 2016
1 parent e4c7401 commit d31d2e9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions census/ui_app/validators.js
Expand Up @@ -12,6 +12,17 @@ let validators = {
return !validator.isEmpty(value.toString());
},
message: 'Question is required'
},
sourceIsURL: {
rule: value => {
for (let i = 0; i < value.length; i++) {
if (!validator.isURL(value[i].urlValue)) {
return false;
}
}
return true;
},
message: 'Each source URL must be a valid URL'
}
};

Expand Down

0 comments on commit d31d2e9

Please sign in to comment.