Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js |
— | — | @@ -784,8 +784,11 @@ |
785 | 785 | if ( _this.detailsValid() ) { |
786 | 786 | _this.hideDetailsEndButtons(); |
787 | 787 | _this.detailsSubmit( function() { |
| 788 | + _this.detailsErrorCount(); |
788 | 789 | _this.showNext( 'details', 'complete', finalizeDetails ); |
789 | 790 | } ); |
| 791 | + } else { |
| 792 | + _this.detailsErrorCount(); |
790 | 793 | } |
791 | 794 | }; |
792 | 795 | |
— | — | @@ -1321,6 +1324,25 @@ |
1322 | 1325 | ); |
1323 | 1326 | }, |
1324 | 1327 | |
| 1328 | + /** |
| 1329 | + * The details page can be vertically long so sometimes it is not obvious there are errors above. This counts them and puts the count |
| 1330 | + * right next to the submit button, so it should be obvious to the user they need to fix things. |
| 1331 | + * This is a bit of a hack. The validator library actually already has a way to count errors but some errors are generated |
| 1332 | + * outside of that library. So we are going to just look for any visible inputs in an error state. |
| 1333 | + */ |
| 1334 | + detailsErrorCount: function() { |
| 1335 | + var errorCount = |
| 1336 | + $( '#mwe-upwiz-stepdiv-details' ).find( 'input.mwe-error' ).length |
| 1337 | + + $( '#mwe-upwiz-stepdiv-details' ).find( 'textarea.mwe-error' ).length |
| 1338 | + + $( '#mwe-upwiz-stepdiv-details' ).find( 'input.mwe-validator-error' ).length |
| 1339 | + + $( '#mwe-upwiz-stepdiv-details' ).find( 'textarea.mwe-validator-error' ).length; |
| 1340 | + if ( errorCount > 0 ) { |
| 1341 | + $( '#mwe-upwiz-details-error-count' ).msg( 'mwe-upwiz-details-error-count', errorCount, this.uploads.length ); |
| 1342 | + } else { |
| 1343 | + $( '#mwe-upwiz-details-error-count' ).empty(); |
| 1344 | + } |
| 1345 | + }, |
| 1346 | + |
1325 | 1347 | prefillThanksPage: function() { |
1326 | 1348 | var _this = this; |
1327 | 1349 | |