diff options
Diffstat (limited to 'www/js/views/submit.js')
-rw-r--r-- | www/js/views/submit.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/www/js/views/submit.js b/www/js/views/submit.js index 3e1ef8e..654fb01 100644 --- a/www/js/views/submit.js +++ b/www/js/views/submit.js @@ -43,6 +43,7 @@ } else { this.report = new FMS.Report( this.model.toJSON() ); this.listenTo( this.report, 'sync', this.onReportSync ); + this.listenTo( this.report, 'invalid', this.onReportInvalid ); this.listenTo( this.report, 'error', this.onReportError ); this.report.save(); } @@ -73,6 +74,19 @@ this.navigate( 'sent' ); }, + onReportInvalid: function(model, err, options) { + var errors = err.errors; + var errorList = '<ul><li class="plain">Invalid report</li>'; + for ( var k in errors ) { + // FIXME! to stop jslint complaining for now + if ( k !== '' ) { + errorList += '<li>' + errors[k] + '</li>'; + } + } + errorList += '</ul>'; + $('#errors').html(errorList).show(); + }, + onReportError: function(model, err, options) { alert( FMS.strings.sync_error + ': ' + err.errors); }, |