=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2014-09-17 11:43:40 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2014-09-18 11:23:17 +0000 @@ -121,7 +121,7 @@ dhis2.de.on = function( event, fn ) { $( document ).off( event ).on( event, fn ); -} +}; var DAO = DAO || {}; @@ -2080,7 +2080,11 @@ if( typeof form !== 'undefined' ) { def.resolve( form.data ); } else { - def.resolve( "A form with that ID is not available. Please clear browser cache and try again." ); + dhis2.de.storageManager.loadForm( dataSetId ).done(function( data ) { + def.resolve( data ); + }).error(function() { + def.resolve( "A form with that ID is not available. Please clear browser cache and try again." ); + }); } }); @@ -2121,6 +2125,24 @@ }; /** + * Loads a form directly from the server, does not try to save it in the + * browser (so that it doesn't interfere with any current downloads). + * + * @param dataSetId + * @returns {*} + */ + this.loadForm = function( dataSetId ) + { + return $.ajax({ + url: 'loadForm.action', + data: { + dataSetId: dataSetId + }, + dataType: 'text' + }); + }; + + /** * Downloads the form for the data set with the given identifier from the * remote server and saves the form locally. Potential existing forms with * the same identifier will be overwritten. Updates the form version.