=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormService.java 2012-09-15 14:27:07 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormService.java 2012-09-16 14:44:45 +0000 @@ -48,7 +48,7 @@ final Pattern DATAELEMENT_TOTAL_PATTERN = Pattern.compile( "dataelementid=\"(.*?)\"" ); final Pattern INDICATOR_PATTERN = Pattern.compile( "indicatorid=\"(.*?)\"" ); final Pattern DYNAMIC_INPUT_PATTERN = Pattern.compile( "(.*?)-(.*?)-dyninput" ); - final Pattern DYNAMIC_SELECT_PATTERN = Pattern.compile( "(.*?)-(.*?)-dynselect" ); + final Pattern DYNAMIC_SELECT_PATTERN = Pattern.compile( "dynselect=\"(.*?)\"" ); final Pattern VALUE_TAG_PATTERN = Pattern.compile( "value=\"(.*?)\"", Pattern.DOTALL ); final Pattern TITLE_TAG_PATTERN = Pattern.compile( "title=\"(.*?)\"", Pattern.DOTALL ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java 2012-09-16 00:11:12 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java 2012-09-16 14:44:45 +0000 @@ -230,7 +230,7 @@ } else if ( dynamicSelectMatcher.find() && dynamicSelectMatcher.groupCount() > 0 ) { - int categoryComboId = Integer.parseInt( dynamicSelectMatcher.group( 2 ) ); + int categoryComboId = Integer.parseInt( dynamicSelectMatcher.group( 1 ) ); DataElementCategoryCombo categoryCombo = categoryService.getDataElementCategoryCombo( categoryComboId ); displayValue = categoryCombo != null ? "value=\"[ " + categoryCombo.getDisplayName() + " ]\"" : "[ " + i18n.getString( "cat_combo_not_exist" ); @@ -283,6 +283,7 @@ String inputHtml = inputMatcher.group(); Matcher identifierMatcher = IDENTIFIER_PATTERN.matcher( inputHtml ); + Matcher dynamicInputMather = DYNAMIC_INPUT_PATTERN.matcher( inputHtml ); Matcher dynamicSelectMatcher = DYNAMIC_SELECT_PATTERN.matcher( inputHtml ); if ( identifierMatcher.find() && identifierMatcher.groupCount() > 0 ) @@ -328,6 +329,20 @@ inputHtml += "" + dataElement.getFormNameFallback() + ""; inputHtml += "" + categoryOptionCombo.getName() + ""; } + else if ( dynamicInputMather.find() && dynamicInputMather.groupCount() > 0 ) + { + int optionComboId = Integer.parseInt( dynamicInputMather.group( 2 ) ); + + DataElementCategoryOptionCombo categoryOptionCombo = categoryService + .getDataElementCategoryOptionCombo( optionComboId ); + + if ( categoryOptionCombo == null ) + { + return i18n.getString( "category_option_combo_with_id" ) + ": " + optionComboId + " " + i18n.getString( "does_not_exist" ); + } + + inputHtml = inputHtml.replace( TAG_CLOSE, " name=\"dyninput\" tabindex=\"" + i++ + "\"" + TAG_CLOSE ); + } else if ( dynamicSelectMatcher.find() && dynamicSelectMatcher.groupCount() > 0 ) { inputHtml = inputHtml.replace( "= 0) + if( text2.indexOf( text1 ) >= 0 ) { - $(item).parent().show(); + $( item ).parent().show(); } else { - $(item).parent().hide(); + $( item ).parent().hide(); } - }); + } ); } - refreshZebraStripes($tbody); + refreshZebraStripes( $tbody ); } -function refreshZebraStripes($tbody) +function refreshZebraStripes( $tbody ) { $tbody.find( 'tr:not([colspan]):visible:even' ).find( 'td:first-child' ).removeClass( 'reg alt' ).addClass('alt' ); $tbody.find( 'tr:not([colspan]):visible:odd' ).find( 'td:first-child' ).removeClass( 'reg alt' ).addClass('reg' ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/viewDataEntryForm.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/viewDataEntryForm.js 2012-09-16 00:11:12 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/viewDataEntryForm.js 2012-09-16 14:44:45 +0000 @@ -369,26 +369,26 @@ /** * A unique code is used to associate the data element drop down with the input - * fields for each category option combo. The format for select / drop down list - * identifier is: + * fields for each category option combo. The format for select / drop down list + * is: * - * "-dyncselect" + * id="-dynselect" dyncselect="" */ function insertDropDownList() { var oEditor = $("#designTextarea").ckeditorGet(); - if ( currentDynamicElementCode && currentCategoryComboId ) { - var id = currentDynamicElementCode + "-" + currentCategoryComboId + "-dynselect"; - var template = ''; + var id = currentDynamicElementCode + "-dynselect"; + var template = ''; oEditor.insertHtml( template ); } } /** * A unique code is used to associate the data element drop down with the input - * fields for each category option combo. The format for input field identifier is: + * fields for each category option combo. The format for input field identifier + * is: * - * "--dyninput" + * id="--dyninput" */ function insertDynamicElement() { var oEditor = $("#designTextarea").ckeditorGet();