=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/defaultForm.vm' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/defaultForm.vm 2013-02-05 13:30:47 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/defaultForm.vm 2013-05-21 06:54:08 +0000 @@ -48,7 +48,11 @@ #else - + #if( $dataElement.optionSet ) + + #else + + #end #end #set( $tabIndex = $tabIndex + 1 ) === 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-21 06:03:05 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2013-05-21 06:54:08 +0000 @@ -412,7 +412,32 @@ $( this ).css( 'width', '90%' ); } ); - + + $( '[name="entryoptionset"]' ).each( function( i ) + { + var id = $( this ).attr( 'id' ); + var split = splitFieldId( id ); + + var dataElementId = split.dataElementId; + var optionComboId = split.optionComboId; + + $( this ).unbind( 'focus' ); + $( this ).unbind( 'change' ); + + $( this ).focus( valueFocus ); + $( this ).blur( valueBlur ); + + $( this ).change( function() + { + saveVal( dataElementId, optionComboId, id ); + } ); + + if ( formType != FORMTYPE_CUSTOM ) { + $( this ).css( 'width', '80%' ); + $( this ).css( 'text-align', 'center' ); + } + } ); + $( '[name="commentlink"]' ).each( function( i ) { var id = $( this ).attr( 'id' ); @@ -546,8 +571,8 @@ $( '#currentOrganisationUnit' ).html( i18n_no_organisationunit_selected ); } - loadDataValues(); insertOptionSets(); + loadDataValues(); } ); } } @@ -1076,11 +1101,13 @@ $( '[name="entryfield"]' ).val( '' ); $( '[name="entryselect"]' ).val( '' ); + $( '[name="entryoptionset"]' ).val( '' ); $( '[name="dyninput"]' ).val( '' ); $( '[name="dynselect"]' ).val( '' ); $( '[name="entryfield"]' ).css( 'background-color', COLOR_WHITE ); $( '[name="entryselect"]' ).css( 'background-color', COLOR_WHITE ); + $( '[name="entryoptionset"]' ).css( 'background-color', COLOR_WHITE ); $( '[name="dyninput"]' ).css( 'background-color', COLOR_WHITE ); $( '[name="min"]' ).html( '' ); @@ -1536,7 +1563,7 @@ if ( fieldCombinationRequired ) { var violations = false; - + $( '[name="entryfield"]' ).add( '[name="entryselect"]' ).each( function( i ) { var id = $( this ).attr( 'id' ); @@ -2277,13 +2304,29 @@ } function insertOptionSets() { - $.each( _.keys(optionSets), function(idx, item) { - autocompleteOptionSetField( item + '-val', optionSets[item] ); - }); + $( '[name="entryoptionset"]' ).each( function ( idx, item ) { + var optionSetKey = splitFieldId( item.id ); + + if ( multiOrganisationUnit ) { + item = optionSetKey.organisationUnitId + '-' + optionSetKey.dataElementId + '-' + optionSetKey.optionComboId; + } else { + item = optionSetKey.dataElementId + '-' + optionSetKey.optionComboId; + } + + item = item + '-val'; + optionSetKey = optionSetKey.dataElementId + '-' + optionSetKey.optionComboId; + + autocompleteOptionSetField( item, optionSets[optionSetKey] ); + } ); } function autocompleteOptionSetField( idField, optionSetUid ) { var input = jQuery( "#" + idField ); + + if ( !input ) { + return; + } + input.css( "width", "85%" ); input.autocomplete( { delay: 0, === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/multiOrgSectionForm.vm' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/multiOrgSectionForm.vm 2013-03-20 10:36:37 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/multiOrgSectionForm.vm 2013-05-21 06:54:08 +0000 @@ -87,7 +87,11 @@ #else - + #if( $dataElement.optionSet ) + + #else + + #end #end #set( $tabIndex = $tabIndex + 1 ) === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/sectionForm.vm' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/sectionForm.vm 2013-03-20 08:29:43 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/sectionForm.vm 2013-05-21 06:54:08 +0000 @@ -67,7 +67,11 @@ #else - + #if( $dataElement.optionSet ) + + #else + + #end #end #set( $tabIndex = $tabIndex + 1 )