=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/i18n.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/i18n.js 2009-11-08 20:18:11 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/i18n.js 2010-03-09 08:30:08 +0000 @@ -1,3 +1,12 @@ +//---------------------------------------------------------- +// Regular Expression using for checking shortname' value +//---------------------------------------------------------- + +regexShortName = /^[\w][\w\d]+$/; + +//---------------------------------------------------------- + + function updateTranslation() { var id = document.getElementById("id").value; @@ -137,3 +146,36 @@ document.getElementById('message').style.display = 'block'; } + +function applyingPatternForShortName( shortNameValue ) +{ + return shortNameValue.match( regexShortName ); +} + +function validateAddTranslation() +{ + var shortNameField = byId( 'shortName' ); + var shortNameVal = shortNameField.value; + + if ( shortNameVal.length > 0 ) + { + if ( applyingPatternForShortName( shortNameVal ) == null ) + { + setMessage( shortname_invalidated ); + shortNameField.select(); + return false; + } + else if ( shortNameVal.length > 25 ) + { + setMessage( shortname_length ); + shortNameField.select(); + return false; + } + else + { + return true; + } + } + + return true; +} === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/translate.vm' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/translate.vm 2010-03-08 14:50:40 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/translate.vm 2010-03-09 08:30:08 +0000 @@ -1,6 +1,6 @@ -