=== 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 2011-05-10 09:48:46 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java 2011-05-10 11:24:17 +0000 @@ -187,49 +187,25 @@ if ( dataElement != null ) { - displayValue = "[ " + dataElement.getShortName() + " " + optionComboName + " ]"; - - if ( inputHtml.contains( EMPTY_VALUE_TAG ) ) - { - inputHtml = inputHtml.replace( EMPTY_VALUE_TAG, "value=\"" + displayValue + "\"" ); - } - else - { - inputHtml += " value=\"" + displayValue + "\""; - } - + displayValue = "value=\"[ " + dataElement.getShortName() + " " + optionComboName + " ]\""; + + inputHtml = inputHtml.contains( EMPTY_VALUE_TAG ) ? inputHtml.replace( EMPTY_VALUE_TAG, displayValue ) : inputHtml + " " + displayValue; + StringBuilder title = new StringBuilder( "title=\"[ " ).append( dataElement.getId() ).append( " - " ). append( dataElement.getShortName() ).append( " - " ).append( optionComboId ).append( " - " ). append( optionComboName ).append( " - " ).append( dataElement.getType() ).append( " ]\"" ); - if ( inputHtml.contains( EMPTY_TITLE_TAG ) ) - { - inputHtml = inputHtml.replace( EMPTY_TITLE_TAG, title ); - } - else - { - inputHtml += " " + title; - } + inputHtml = inputHtml.contains( EMPTY_TITLE_TAG ) ? inputHtml.replace( EMPTY_TITLE_TAG, title ) : " " + title; } else { - if ( inputHtml.contains( EMPTY_VALUE_TAG ) ) - { - inputHtml = inputHtml.replace( EMPTY_VALUE_TAG, "value=\"" + displayValue + "\"" ); - } - else - { - inputHtml += " value=\"" + displayValue + "\""; - } - - if ( inputHtml.contains( EMPTY_TITLE_TAG ) ) - { - inputHtml = inputHtml.replace( EMPTY_TITLE_TAG, "title=\"" + displayValue + "\"" ); - } - else - { - inputHtml += " title=\"" + displayValue + "\""; - } + String displayNotExisting = "value=\"" + displayValue + "\""; + + inputHtml = inputHtml.contains( EMPTY_VALUE_TAG ) ? inputHtml.replace( EMPTY_VALUE_TAG, displayNotExisting ) : inputHtml + displayNotExisting; + + displayNotExisting = "title=\"" + displayValue + "\""; + + inputHtml = inputHtml.contains( EMPTY_TITLE_TAG ) ? inputHtml.replace( EMPTY_TITLE_TAG, displayNotExisting ) : inputHtml + displayNotExisting; } inputMatcher.appendReplacement( sb, inputHtml );