dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #12141
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3659: Reverted r 3625
------------------------------------------------------------
revno: 3659
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-05-19 10:15:10 +0200
message:
Reverted r 3625
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttribute.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.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/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm 2011-05-19 08:13:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm 2011-05-19 08:15:10 +0000
@@ -1,30 +1,23 @@
<script>
+ var i18n_remove_option = '$encoder.jsEscape( $i18n.getString( "remove_option" ) , "'") ';
+ var i18n_field_is_required = '$encoder.jsEscape( $i18n.getString( "field_is_required" ) , "'") ';
var isSubmit = true;
- jQuery(document).ready( function(){
-
- validation( 'addPatientAttributeForm', function(form){
- if( isSubmit )
- {
- addPatientAttribute();
+ jQuery("#addPatientAttributeForm").ready( function(){
+ validation( 'addPatientAttributeForm', function(form){
+ if( isSubmit && ATTRIBUTE_OPTION.checkOnSubmit() ) {
+ form.submit(i18n_field_is_required);
}
}, function(){
- isSubmit = ATTRIBUTE_OPTION.checkOnSubmit();
+ isSubmit = true;
- if( isSubmit )
- {
- var fields = $("#addPatientAttributeForm").serializeArray();
- jQuery.each(fields, function(i, field) {
- if( field.name.match("^attrOption")=='attrOption' && field.value == ""){
- setInnerHTML( "attrMessage", i18n_field_is_required );
- isSubmit = false;
- }
- });
-
- }else
- {
- setInnerHTML( "attrMessage", i18n_at_least_2_option );
- }
- });
+ var fields = $("#addPatientAttributeForm").serializeArray();
+ jQuery.each(fields, function(i, field) {
+ if( field.name.match("^attrOption")=='attrOption' && field.value == ""){
+ setInnerHTML("attrMessage", i18n_field_is_required);
+ isSubmit = false;
+ }
+ });
+ });
jQuery("#attributeComboRow").hide();
@@ -36,7 +29,7 @@
<input type="button" value="$i18n.getString( 'back' )" onclick="javascript:onClickBackBtn();" style="width:10em">
<h3>$i18n.getString( "add_new_patient_attribute" )</h3>
-<form id="addPatientAttributeForm" name='addPatientAttributeForm' action='addPatientAttribute.action' method="post">
+<form id="addPatientAttributeForm" method="post">
<table id="attrTable">
<thead>
@@ -110,7 +103,7 @@
</tbody>
</table>
<p>
- <input type="submit" value="$i18n.getString( 'add' )" style="width:10em" />
+ <input type="button" value="$i18n.getString( 'add' )" style="width:10em" onclick="addPatientAttribute();"/>
</p>
</form>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js 2011-05-19 08:14:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js 2011-05-19 08:15:10 +0000
@@ -62,7 +62,7 @@
});
if( $("input","#attrOptionContainer").length < 2)
{
- //alert(i18n_at_least_2_option);
+ alert(i118_at_least_2_option);
return false;
}else return true;
}
@@ -97,7 +97,7 @@
},
createInput : function ()
{
- return "<tr><td><input type='text' id='attrOptions' name='attrOptions' style='width:28em'/><a href='#' style='text-decoration: none; margin-left:0.5em;' title='"+i18n_remove_option+"' onClick='ATTRIBUTE_OPTION.remove(this,null)'>[ - ]</a></td></tr>";
+ return "<tr><td><input type='text' name='attrOptions' style='width:28em'/><a href='#' style='text-decoration: none; margin-left:0.5em;' title='"+i18n_remove_option+"' onClick='ATTRIBUTE_OPTION.remove(this,null)'>[ - ]</a></td></tr>";
}
}
@@ -123,7 +123,7 @@
$.ajax({
type: "POST",
url: 'addPatientAttribute.action',
- data: getParamsForDiv('addPatientAttributeForm'),
+ data: getParamsForDiv('editPatientAttributeForm'),
success: function( json ) {
if( json.response == 'success')
{
@@ -159,18 +159,15 @@
$.ajax({
type: "POST",
url: 'updatePatientAttribute.action',
- data: getParamsForDiv('updatePatientAttributeForm'),
- dataType: 'json',
+ data: getParamsForDiv('editPatientAttributeForm'),
success: function( json ) {
if( json.response == 'success')
{
onClickBackBtn();
}
}
- });
-
- return false;
-
+ });
+ return false;
}
// ------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttribute.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttribute.vm 2011-05-19 08:14:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttribute.vm 2011-05-19 08:15:10 +0000
@@ -22,8 +22,4 @@
var i18n_combo = '$encoder.jsEscape( $i18n.getString( "combo" ) , "'")';
var i18n_processing = '$encoder.jsEscape( $i18n.getString( "processing" ) , "'")';
var i18n_done = '$encoder.jsEscape( $i18n.getString( "done" ) , "'")';
-
- var i18n_remove_option = '$encoder.jsEscape( $i18n.getString( "remove_option" ) , "'") ';
- var i18n_at_least_2_option = '$encoder.jsEscape( $i18n.getString( "at_least_2_option" ) , "'") ';
- var i18n_field_is_required = '$encoder.jsEscape( $i18n.getString( "field_is_required" ) , "'") ';
</script>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm 2011-05-19 08:13:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm 2011-05-19 08:15:10 +0000
@@ -1,30 +1,25 @@
<script>
+ var i18n_remove_option = '$encoder.jsEscape( $i18n.getString( "remove_option" ) , "'") ';
+ var i118_at_least_2_option = '$encoder.jsEscape( $i18n.getString( "at_least_2_option" ) , "'") ';
+ var i18n_field_is_required = '$encoder.jsEscape( $i18n.getString( "field_is_required" ) , "'") ';
var isSubmit = true;
jQuery(document).ready( function(){
validation( 'updatePatientAttributeForm', function(form){
- if( isSubmit )
- {
- updatePatientAttribute();
+ if( isSubmit && ATTRIBUTE_OPTION.checkOnSubmit() ) {
+ form.submit(i18n_field_is_required);
}
}, function(){
- isSubmit = ATTRIBUTE_OPTION.checkOnSubmit();
+ isSubmit = true;
- if( isSubmit )
- {
- var fields = $("#addPatientAttributeForm").serializeArray();
- jQuery.each(fields, function(i, field) {
- if( field.name.match("^attrOption")=='attrOption' && field.value == ""){
- setInnerHTML( "attrMessage", i18n_field_is_required );
- isSubmit = false;
- }
- });
-
- }else
- {
- setInnerHTML( "attrMessage", i18n_at_least_2_option );
- }
+ var fields = $("#addPatientAttributeForm").serializeArray();
+ jQuery.each(fields, function(i, field) {
+ if( field.name.match("^attrOption")=='attrOption' && field.value == ""){
+ setInnerHTML("attrMessage", i18n_field_is_required);
+ isSubmit = false;
+ }
+ });
});
checkValueIsExist( "name", "validatePatientAttribute.action", {id:getFieldValue('id')});
@@ -36,7 +31,7 @@
<h3>$i18n.getString( "update_patient_attribute" )</h3>
-<form id="updatePatientAttributeForm" name="updatePatientAttributeForm" action='updatePatientAttribute.action' method="post" >
+<form id="updatePatientAttributeForm" name="updatePatientAttributeForm" action='#' method="post" onsubmit='return updatePatientAttribute();'>
<div style="display:inline">
<input type="hidden" id="id" name="id" value="$patientAttribute.id">