diff options
author | Struan Donald <struan@exo.org.uk> | 2013-06-19 12:03:00 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2013-06-19 12:14:00 +0100 |
commit | 57135a960b3b32b1689dd9ff6a9cf5e29f347693 (patch) | |
tree | 5a7b37a88a8c070f806825cae0bcb039b24ba89d /www/js | |
parent | 6f21e968c74e335b8f5c7b9ecfc968db9c042a5c (diff) |
validate extra open311 fields
Diffstat (limited to 'www/js')
-rw-r--r-- | www/js/views/details_extra.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/www/js/views/details_extra.js b/www/js/views/details_extra.js index bc030d3..7a96e8c 100644 --- a/www/js/views/details_extra.js +++ b/www/js/views/details_extra.js @@ -30,9 +30,19 @@ onClickButtonNext: function() { this.clearValidationErrors(); var valid = 1; + var that = this; + var isRequired = function(index) { + var el = $(this); + if ( el.attr('required') && el.val() === '' ) { + valid = 0; + that.validationError(el.attr('id'), FMS.strings.required); + } + }; // do validation - + $('input').each(isRequired); + $('textarea').each(isRequired); + $('select').each(isRequired); if ( valid ) { this.clearValidationErrors(); |