=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js 2013-05-23 10:40:52 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js 2013-06-11 21:03:10 +0000 @@ -17,6 +17,7 @@ var FORMULA_PATTERN = /#\{.+?\}/g; var SEPARATOR = '.'; +var EVENT_VALUE_SAVED = 'dhis-web-dataentry-value-saved'; function updateDataElementTotals() { @@ -266,6 +267,14 @@ return false; } +/** + * Convenience method which can be used in custom form scripts. Do not change. + */ +function onValueSave( fn ) +{ + $( 'body' ).off( EVENT_VALUE_SAVED ).on( EVENT_VALUE_SAVED, fn ); +} + // ----------------------------------------------------------------------------- // Saver objects // ----------------------------------------------------------------------------- @@ -312,6 +321,8 @@ markValue( fieldId, COLOR_RED ); window.alert( i18n_saving_value_failed_status_code + '\n\n' + code ); } + + $( 'body' ).trigger( EVENT_VALUE_SAVED, dataValue ); } function handleError( jqXHR, textStatus, errorThrown ) === 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 2013-05-29 21:44:35 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2013-06-11 21:03:10 +0000 @@ -1393,6 +1393,14 @@ } } +/** + * Convenience method which can be used in custom form scripts. Do not change. + */ +function onFormLoad( fn ) +{ + $( 'body' ).off( EVENT_FORM_LOADED ).on( EVENT_FORM_LOADED, fn ); +} + // ----------------------------------------------------------------------------- // Data completeness // -----------------------------------------------------------------------------