dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18014
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7421: Add validation for number fields in single event dataentry form.
------------------------------------------------------------
revno: 7421
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-06-27 15:21:26 +0700
message:
Add validation for number fields in single event dataentry form.
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/select.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm 2012-06-27 07:34:44 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm 2012-06-27 08:21:26 +0000
@@ -48,7 +48,7 @@
<div id='dataForm'>#parse( "/dhis-web-caseentry/dataEntryForm.vm" )</div>
<p>
<input type="submit" class="button" value="$i18n.getString( 'add' )" />
- <input type="button" class="button" value="$i18n.getString( 'back' )" onclick="javascript:showSearchForm();"/>
+ <input type="button" class="button" value="$i18n.getString( 'back' )" onclick="javascript:backAddNewBtn();"/>
</p>
</form>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm 2012-06-27 05:12:36 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm 2012-06-27 08:21:26 +0000
@@ -80,9 +80,35 @@
datePicker($programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-val', false);
</script>
#elseif($hasOptionSet=='true')
- <input name="entryfield" options='$hasOptionSet' #if($hasOptionSet == 'true') #end dataElementId='$programStageDataElement.dataElement.id' data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" >
+ <input name="entryfield" options='$hasOptionSet' #if($hasOptionSet == 'true') #end dataElementId='$programStageDataElement.dataElement.id' data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )"
+ #set( $type=$programStageDataElement.dataElement.getDetailedNumberType())
+ #if( $type=='number' )
+ class="{validate:{number:true}}"
+ #elseif( $type=='positiveNumber' )
+ class="{validate:{positive_integer:true}}"
+ #elseif( $type=='negativeNumber' )
+ class="{validate:{negative_integer:true}}"
+ #elseif( $type=='int' )
+ class="{validate:{integer:true}}"
+ #end />
#else
- <input name="entryfield" dataElementId='$programStageDataElement.dataElement.id' data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex">
+ <input name="entryfield" dataElementId='$programStageDataElement.dataElement.id'
+ data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }"
+ id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )"
+ onchange="saveVal( $programStageDataElement.dataElement.id )"
+ onkeypress="return keyPress(event, this)" tabindex="$tabIndex"
+
+ #set( $type=$programStageDataElement.dataElement.getDetailedNumberType())
+ #if( $type=='number' )
+ class="{validate:{number:true}}"
+ #elseif( $type=='positiveNumber' )
+ class="{validate:{positive_integer:true}}"
+ #elseif( $type=='negativeNumber' )
+ class="{validate:{negative_integer:true}}"
+ #elseif( $type=='int' )
+ class="{validate:{integer:true}}"
+ #end
+ />
#end
</td>
#if( $!programStageInstance.programStage.program.isRegistration() == 'true' )
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js 2012-06-27 07:34:44 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js 2012-06-27 08:21:26 +0000
@@ -27,6 +27,7 @@
showById('contentDiv');
hideById('addNewDiv');
jQuery('#createNewEncounterDiv').dialog('close');
+ jQuery('#resultSearchDiv').dialog('close');
}
//--------------------------------------------------------------------------------------------
@@ -44,6 +45,7 @@
hideById('dataEntryFormDiv');
showById('searchDiv');
setInnerHTML('searchInforTD', i18n_list_all_patients );
+ setFieldValue('listAll', true);
hideLoader();
});
}
@@ -95,6 +97,7 @@
function()
{
showById('searchDiv');
+ setFieldValue('listAll', false);
hideLoader();
});
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js 2012-06-27 07:34:44 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js 2012-06-27 08:21:26 +0000
@@ -108,6 +108,8 @@
data: params,
success: function(json) {
showSuccessMessage( i18n_save_success );
+ jQuery("#resultSearchDiv").dialog("close");
+ setFieldvalue('listAll', true);
}
});
return false;
@@ -192,4 +194,11 @@
if( jQuery(this).is(":disabled"))
jQuery(this).val("");
});
-}
\ No newline at end of file
+}
+
+function backAddNewBtn()
+{
+ showSearchForm();
+ if( getFieldvalue('listAll')=='true')
+ listPatientBtn();
+}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/select.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/select.vm 2012-06-27 05:12:36 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/select.vm 2012-06-27 08:21:26 +0000
@@ -6,6 +6,7 @@
<h3>$i18n.getString( "name_based_data_entry" ) #openHelp('name_based_data_entry')</h3>
<input type='hidden' id='isRegistration' name= 'isRegistration' value='false'>
+<input type='hidden' id='listAll' name= 'listAll' >
<div id='searchDiv'>
#parse( "dhis-web-caseentry/searchPatientCriteria.vm" )
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm 2012-06-27 05:12:36 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm 2012-06-27 08:21:26 +0000
@@ -1,4 +1,6 @@
<h3>$i18n.getString( "patient_management" ) #openHelp( "patient" )</h3>
+<input type='hidden' id='isRegistration' name= 'isRegistration' value='false'>
+<input type='hidden' id='listAll' name= 'listAll' >
<div id='searchDiv'>
#parse( "dhis-web-caseentry/searchPatientCriteria.vm" )
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm 2012-06-27 07:34:44 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm 2012-06-27 08:21:26 +0000
@@ -12,6 +12,7 @@
<h3>$i18n.getString( "single_event_with_registration" )</h3>
<input type='hidden' id='isRegistration' name= 'isRegistration' value='true'>
+<input type='hidden' id='listAll' name= 'listAll' >
<input type='hidden' id='patientId' name= 'patientId' >
<div id='searchDiv'>