=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/utils/FormUtils.java' --- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/utils/FormUtils.java 2011-12-26 10:07:59 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/utils/FormUtils.java 2011-12-27 12:51:59 +0000 @@ -27,14 +27,8 @@ package org.hisp.dhis.light.dataentry.utils; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; - import org.apache.commons.collections.CollectionUtils; +import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator; import org.hisp.dhis.dataanalysis.DataAnalysisService; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; @@ -58,6 +52,8 @@ import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.ISODateTimeFormat; +import java.util.*; + /** * @author mortenoh */ @@ -129,7 +125,7 @@ @SuppressWarnings( "unchecked" ) public Map getValidationViolations( OrganisationUnit organisationUnit, DataSet dataSet, - Period period ) + Period period ) { Map validationErrorMap = new HashMap(); @@ -226,8 +222,7 @@ try { Double.parseDouble( value ); - } - catch ( NumberFormatException e ) + } catch ( NumberFormatException e ) { return false; } @@ -240,8 +235,7 @@ try { Integer.parseInt( value ); - } - catch ( NumberFormatException e ) + } catch ( NumberFormatException e ) { return false; } @@ -271,8 +265,7 @@ { return true; } - } - catch ( NumberFormatException e ) + } catch ( NumberFormatException e ) { } @@ -291,8 +284,7 @@ { return true; } - } - catch ( NumberFormatException e ) + } catch ( NumberFormatException e ) { } @@ -312,11 +304,18 @@ { sdf.parseDateTime( value ); return true; - } - catch ( IllegalArgumentException e ) + } catch ( IllegalArgumentException e ) { } return false; } + + public static List sortedCategoryOptionCombos( Collection categoryOptionCombos ) + { + List sortedCategoryOptionCombos = new ArrayList( categoryOptionCombos ); + Collections.sort( sortedCategoryOptionCombos, new IdentifiableObjectNameComparator() ); + + return sortedCategoryOptionCombos; + } } === modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntrySection.vm' --- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntrySection.vm 2011-12-27 12:16:47 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntrySection.vm 2011-12-27 12:51:59 +0000 @@ -45,9 +45,11 @@ #set( $dataElementName = $dataElement.name ) #end - #foreach( $optionCombo in $dataElement.categoryCombo.optionCombos ) - - #if( !$greyedFields.get( "$dataElement.id:$optionCombo.id" ) ) + #set( $optionCombos = $formUtils.sortedCategoryOptionCombos( $dataElement.categoryCombo.optionCombos ) ) + + #foreach( $optionCombo in $optionCombos ) + + #if( !$greyedFields.get( "$dataElement.id:$optionCombo.id" ) ) #set( $key = "DE${dataElement.id}OC${optionCombo.id}" )