dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18200
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7583: Validate for data-value of dataelement with optionset.
------------------------------------------------------------
revno: 7583
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-07-12 16:01:49 +0700
message:
Validate for data-value of dataelement with optionset.
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.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/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2012-07-12 06:36:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2012-07-12 09:01:49 +0000
@@ -382,4 +382,6 @@
event_is_completed = Event is completed.
the_stage_is_started_but_not_completed_yet = The stage is started, but not completed yet.
the_stage_is_started_and_due_date_is_after_the_current_date = The stage is started and due date is after the current date.
-the_stage_is_not_started_and_due_date_is_before_the_current_date = The stage is not started and due date is before the current date.
\ No newline at end of file
+the_stage_is_not_started_and_due_date_is_before_the_current_date = The stage is not started and due date is before the current date.
+value_is_invalid = Value is invalid
+value_is_valid = Value is valid
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2012-07-12 05:24:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2012-07-12 09:01:49 +0000
@@ -1435,12 +1435,32 @@
},
validateedit: function( editor, e, eOpts )
{
- if( e.column.compulsory && e.column.field.rawValue =='' )
+ var newValue = e.column.field.rawValue;
+ if( e.column.compulsory && newValue =='' )
{
TR.util.notification.error( TR.i18n.not_empty, TR.i18n.not_empty );
return false;
}
- return true;
+
+ var valid = e.column.initialConfig.editor.xtype=="combobox" ? false : true;
+ if(!valid)
+ {
+ e.column.initialConfig.editor.store.each( function(r) {
+ if( newValue==r.data.name){
+ valid = true;
+ }
+ });
+ }
+ if( !valid ){
+ TR.cmp.statusbar.panel.setWidth(TR.cmp.region.center.getWidth());
+ TR.cmp.statusbar.panel.update('<img src="' + TR.conf.finals.ajax.path_images + TR.conf.statusbar.icon.error + '" style="padding:0 5px 0 0"/>' + TR.i18n.value_is_invalid );
+ }
+ else
+ {
+ TR.cmp.statusbar.panel.setWidth(TR.cmp.region.center.getWidth());
+ TR.cmp.statusbar.panel.update('<img src="' + TR.conf.finals.ajax.path_images + TR.conf.statusbar.icon.error + '" style="padding:0 5px 0 0"/>' + TR.i18n.value_is_valid );
+ }
+ return valid;
}
}
});
@@ -1484,9 +1504,10 @@
{
params.editor.xtype = 'combobox';
params.editor.queryMode = 'local';
- params.editor.editable = false;
+ params.editor.editable = true;
params.editor.valueField = 'value';
params.editor.displayField = 'name';
+ params.editor.selectOnFocus = true;
if( type.toLowerCase() == 'bool' ){
params.editor.store = new Ext.data.ArrayStore({
fields: ['value', 'name'],
@@ -1504,11 +1525,11 @@
{
params.editor.xtype = 'combobox';
params.editor.typeAhead = true;
+ params.editor.selectOnFocus = true;
params.editor.triggerAction = 'all';
params.editor.transform = 'light';
params.editor.lazyRender = true;
params.editor.forceSelection = true;
- params.editor.minChars = 2;
params.editor.hideTrigger = true;
params.editor.validateOnBlur = true;
params.editor.queryMode = 'remote';
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.vm 2012-07-09 08:32:27 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.vm 2012-07-12 09:01:49 +0000
@@ -88,5 +88,7 @@
saving:'$encoder.jsEscape($i18n.getString( 'saving' ) , "'")',
renaming:'$encoder.jsEscape($i18n.getString( 'renaming' ) , "'")',
true_value:'$encoder.jsEscape($i18n.getString( 'true_value' ) , "'")',
-false_value:'$encoder.jsEscape($i18n.getString( 'false_value' ) , "'")'
+false_value:'$encoder.jsEscape($i18n.getString( 'false_value' ) , "'")',
+value_is_invalid:'$encoder.jsEscape($i18n.getString( 'value_is_invalid' ) , "'")',
+value_is_valid:'$encoder.jsEscape($i18n.getString( 'value_is_valid' ) , "'")',
};
\ No newline at end of file