dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21099
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9901: Display validation details for custom patient registration form.
------------------------------------------------------------
revno: 9901
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-02-26 11:24:48 +0700
message:
Display validation details for custom patient registration form.
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewPatientRegistationForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientRegistrationForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.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-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2013-02-25 07:12:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2013-02-26 04:24:48 +0000
@@ -352,4 +352,6 @@
min_dataelement_value = Minimum of data element values
max_dataelement_value = Maximum of data element values
assign_program_to_userroles = Assign program to userroles
-property_is_inserted = The property is inserted
\ No newline at end of file
+property_is_inserted = The property is inserted
+please_insert_all_required_fields = Please insert all required fields
+required_fields_valivation = Required fields validation
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewPatientRegistationForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewPatientRegistationForm.js 2013-02-25 07:12:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewPatientRegistationForm.js 2013-02-26 04:24:48 +0000
@@ -3,7 +3,7 @@
{
$('#selectionDialog' ).dialog(
{
- title:'fafds',
+ title:i18n_properties,
maximize:true,
closable:true,
modal:false,
@@ -45,31 +45,38 @@
showById('programAttrTab');
}
-function validateForm()
+function getRequiredFields()
{
- var result = false;
- var html = jQuery("#designTextarea").ckeditorGet().getData();
-
- var requiredFields = new Array();
- requiredFields.push('fixedattributeid=registrationDate');
- requiredFields.push('fixedattributeid=fullName');
- requiredFields.push('fixedattributeid=gender');
- requiredFields.push('fixedattributeid=birthDate');
-
+ var requiredFields = {};
+
+ requiredFields['fixedattributeid=registrationDate'] = i18n_registration_date;
+ requiredFields['fixedattributeid=fullName'] = i18n_full_name;
+ requiredFields['fixedattributeid=gender'] = i18n_gender;
+ requiredFields['fixedattributeid=birthDate'] = i18n_date_of_birth;
+
jQuery('#identifiersSelector option').each(function() {
var item = jQuery(this);
if( item.attr('mandatory')=='true'){
- requiredFields.push('identifierid=' + item.val());
+ requiredFields['identifierid=' + item.val()] = item.text();
}
});
jQuery('#attributesSelector option').each(function() {
var item = jQuery(this);
if( item.attr('mandatory')=='true'){
- requiredFields.push('attributeid=' + item.val());
+ requiredFields['attributeid=' + item.val()] = item.text();
}
});
+
+ return requiredFields;
+}
+function validateForm()
+{
+ var result = false;
+ var html = jQuery("#designTextarea").ckeditorGet().getData();
+ requiredFields = getRequiredFields();
+
var input = jQuery( html ).find("input");
if( input.length > 0 )
{
@@ -93,18 +100,35 @@
key = 'programid=' + inputKey
}
- for (var idx=0; idx<requiredFields.length; idx++){
- var field = requiredFields[idx];
- if( key == field)
+ for (var idx in requiredFields){
+ //var field = requiredFields[idx];
+ if( key == idx)
{
- requiredFields.splice(idx,1);
+ //requiredFields.splice(idx,1);
+ delete requiredFields[idx];
}
}
});
}
- if( requiredFields.length > 0 ) {
+ if( Object.keys(requiredFields).length > 0 ) {
setFieldValue('requiredField','');
+ var violate = '<h3>' + i18n_please_insert_all_required_fields + '<h3>';
+ for (var idx in requiredFields){
+ violate += " - " + requiredFields[idx] + '<br>';
+ }
+
+ setInnerHTML('validateDiv', violate);
+ jQuery('#validateDiv').dialog({
+ title:i18n_required_fields_valivation,
+ maximize:true,
+ closable:true,
+ modal:false,
+ overlay:{background:'#000000', opacity:0.1},
+ width:500,
+ height:300
+ });
+
return false;
}
else{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientRegistrationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientRegistrationForm.vm 2013-02-04 20:56:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientRegistrationForm.vm 2013-02-26 04:24:48 +0000
@@ -13,7 +13,7 @@
<label>$i18n.getString('program')</label>
<select name="programId" id="programId" style="width:20em" >
#if( $display == 'block' )
- <option value=''>[$i18n.getString('please_select')]</option>
+ <option value=''>[$i18n.getString('All')]</option>
#end
#foreach($program in $programs)
<option value='$program.id'>$encoder.htmlEncode($program.displayName)</option>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.vm 2013-02-25 07:12:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.vm 2013-02-26 04:24:48 +0000
@@ -42,7 +42,7 @@
}
</style>
-<form id="saveDataEntryForm" name="saveDataEntryForm" action="savePatientRegistrationForm.action" method="post" onsubmit="validateForm();">
+<form id="saveDataEntryForm" name="saveDataEntryForm" action="savePatientRegistrationForm.action" method="post" onsubmit="return validateForm();">
<input type="hidden" name="id" id="id" value="$!registrationForm.id"/>
<input type="hidden" name="programId" id="programId" value="$!programId"/>
@@ -73,7 +73,10 @@
<table width="100%">
<tr>
- <th>$i18n.getString( "design_patient_registration_form" )</th>
+ <th>
+ $i18n.getString( "design_patient_registration_form" )
+ <input type='hidden' id='requiredField' name='requiredField' class="{validate:{required:true}}" title="$i18n.getString('please_insert_all_required_fields')">
+ </th>
</tr>
<tr>
<td>
@@ -82,9 +85,6 @@
</div>
</td>
</tr>
- <tr>
- <td><input type='hidden' id='requiredField' name='requiredField' class="{validate:{required:true}}"></td>
- </tr>
</table>
</div>
@@ -106,8 +106,7 @@
<table id="fixedAttrTab">
<tr>
<td>
- <input type='text' placeholder="$i18n.getString('filter')" style="width:278px;">
- <input type='button' value="$i18n.getString('filter')" style="width:80px;">
+ <input type='text' placeholder="$i18n.getString('filter')" style="width:365px;" onkeyup="filterList( this.value, 'fixedAttrSelector' )">
<input type='button' value="$i18n.getString('clear')" style="width:80px;">
</td>
</tr>
@@ -131,8 +130,7 @@
<table id="identifierTypeTab" class='hidden'>
<tr>
<td>
- <input type='text' placeholder="$i18n.getString('filter')" style="width:278px;">
- <input type='button' value="$i18n.getString('filter')" style="width:80px;">
+ <input type='text' placeholder="$i18n.getString('filter')" style="width:365px;" onkeyup="filterList( this.value, 'identifiersSelector' )">
<input type='button' value="$i18n.getString('clear')" style="width:80px;">
</td>
</tr>
@@ -150,8 +148,7 @@
<table id="attributeTab" class='hidden'>
<tr>
<td>
- <input type='text' placeholder="$i18n.getString('filter')" style="width:278px;">
- <input type='button' value="$i18n.getString('filter')" style="width:80px;">
+ <input type='text' placeholder="$i18n.getString('filter')" style="width:365px;" onkeyup="filterList( this.value, 'attributesSelector' )">
<input type='button' value="$i18n.getString('clear')" style="width:80px;">
</td>
</tr>
@@ -170,8 +167,7 @@
<table id="programAttrTab" class='hidden'>
<tr>
<td>
- <input type='text' placeholder="$i18n.getString('filter')" style="width:278px;">
- <input type='button' value="$i18n.getString('filter')" style="width:80px;">
+ <input type='text' placeholder="$i18n.getString('filter')" style="width:365px;" onkeyup="filterList( this.value, 'programAttrSelector' )">
<input type='button' value="$i18n.getString('clear')" style="width:80px;">
</td>
</tr>
@@ -205,7 +201,16 @@
</div>
+<div id="validateDiv"></div>
+
<script>
var i18n_delete_program_data_entry_confirm = '$encoder.jsEscape( $i18n.getString( "delete_program_data_entry_confirm" ) , "'" )';
var i18n_property_is_inserted = '$encoder.jsEscape( $i18n.getString( "property_is_inserted" ) , "'" )';
+ var i18n_please_insert_all_required_fields = '$encoder.jsEscape( $i18n.getString( "please_insert_all_required_fields" ) , "'" )';
+ var i18n_required_fields_valivation = '$encoder.jsEscape( $i18n.getString( "required_fields_valivation" ) , "'" )';
+ var i18n_registration_date = '$encoder.jsEscape( $i18n.getString( "registration_date" ) , "'" )';
+ var i18n_full_name = '$encoder.jsEscape( $i18n.getString( "full_name" ) , "'" )';;
+ var i18n_gender = '$encoder.jsEscape( $i18n.getString( "gender" ) , "'" )';;
+ var i18n_date_of_birth = '$encoder.jsEscape( $i18n.getString( "date_of_birth" ) , "'" )';
+ var i18n_properties = '$encoder.jsEscape( $i18n.getString( "properties" ) , "'" )';
</script>