← Back to team overview

dhis-mobile-devs team mailing list archive

[Branch ~dhis-mobile-devs/dhis-mobile/lwuit-tracking] Rev 245: BUGFIX: In the instance registration form, options attributes doesn't have "Option" as no value c...

 

------------------------------------------------------------
revno: 245
committer: sherylyn.marie
branch nick: lwuit-tracking
timestamp: Fri 2014-11-14 01:48:40 +0800
message:
  BUGFIX: In the instance registration form, options attributes doesn't have "Option" as no value choice.
  BUGFIX: In the instance registration form, client accepts blank entries on mandatory fields
modified:
  src/org/hisp/dhis/mobile/view/PersonRegistrationView.java


--
lp:~dhis-mobile-devs/dhis-mobile/lwuit-tracking
https://code.launchpad.net/~dhis-mobile-devs/dhis-mobile/lwuit-tracking

Your team DHIS mobile developers is subscribed to branch lp:~dhis-mobile-devs/dhis-mobile/lwuit-tracking.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis-mobile-devs/dhis-mobile/lwuit-tracking/+edit-subscription
=== modified file 'src/org/hisp/dhis/mobile/view/PersonRegistrationView.java'
--- src/org/hisp/dhis/mobile/view/PersonRegistrationView.java	2014-10-30 04:12:07 +0000
+++ src/org/hisp/dhis/mobile/view/PersonRegistrationView.java	2014-11-13 17:48:40 +0000
@@ -113,7 +113,15 @@
                 mainForm.addComponent( warningLabel );
                 warningLabels.put( patientAttribute.getName(), warningLabel );
 
-                patientAttributeLabel = new Label( patientAttribute.getName() );
+                if ( patientAttribute.isMandatory() )
+                {
+                    patientAttributeLabel = new Label( patientAttribute.getName() + " (*)" );
+
+                }
+                else
+                {
+                    patientAttributeLabel = new Label( patientAttribute.getName() );
+                }
                 mainForm.addComponent( patientAttributeLabel );
 
                 if ( patientAttribute.getType().equals( "bool" ) )
@@ -131,6 +139,7 @@
                 {
                     ComboBox comboBox = new ComboBox();
                     comboBox.setLabelForComponent( patientAttributeLabel );
+                    comboBox.addItem( "Option" );
 
                     for ( int j = 0; j < patientAttribute.getOptionSet().getOptions().size(); j++ )
                     {
@@ -393,6 +402,16 @@
                             value = "";
                         }
                     }
+                    else if ( programAttribute.getType().equals( "optionSet" ) && comboBox.getSelectedIndex() == 0 )
+                    {
+                        value = "";
+                        Label warningLabel = (Label) warningLabels.get( programAttribute.getName() );
+                        if ( programAttribute.isMandatory() )
+                        {
+                            warningLabel.setText( "This field is required" );
+                            this.isValid = false;
+                        }
+                    }
                 }
                 String name = "";
                 name = field.getLabelForComponent().getText().toString().trim();