Commit b78325f1b04783201c1f79a48d40bf31d0514145

Authored by Benjamin Renard
1 parent 337f0c93

Add validation for sampling definition of a deriverd parameter or a data mining request (#8552)

Showing 2 changed files with 50 additions and 2 deletions   Show diff stats
js/app/views/ParameterUI.js
... ... @@ -423,7 +423,19 @@ Ext.define('amdaUI.ParameterUI',
423 423 decimalPrecision : 10,
424 424 hideTrigger: true,
425 425 width: 150,
426   - validateOnBlur: false
  426 + validateOnBlur: false,
  427 + allowBlank: false,
  428 + isValid: function() {
  429 + var me = this,
  430 + disabled = me.disabled,
  431 + validate = me.forceValidation || !disabled;
  432 +
  433 + if (!me.isVisible()) {
  434 + return true;
  435 + }
  436 +
  437 + return validate ? me.validateValue(me.processRawValue(me.getRawValue())) : disabled;
  438 + }
427 439 });
428 440  
429 441 this.refParamField = new Ext.form.TextField({
... ... @@ -433,6 +445,7 @@ Ext.define('amdaUI.ParameterUI',
433 445 name : 'reference_param',
434 446 width: 150,
435 447 hidden: true,
  448 + allowBlank: false,
436 449 listeners: {
437 450 afterrender: function(field, eOpts ){
438 451 var paramTarget = new Ext.dd.DropTarget(field.el.dom,
... ... @@ -477,6 +490,17 @@ Ext.define('amdaUI.ParameterUI',
477 490 );
478 491 },
479 492 scope: this
  493 + },
  494 + isValid: function() {
  495 + var me = this,
  496 + disabled = me.disabled,
  497 + validate = me.forceValidation || !disabled;
  498 +
  499 + if (!me.isVisible()) {
  500 + return true;
  501 + }
  502 +
  503 + return validate ? me.validateValue(me.processRawValue(me.getRawValue())) : disabled;
480 504 }
481 505 });
482 506  
... ...
js/app/views/SearchUI.js
... ... @@ -440,7 +440,19 @@ Ext.define('amdaUI.SearchUI',
440 440 decimalPrecision : 10,
441 441 hideTrigger: true,
442 442 width: 165,
443   - validateOnBlur: false
  443 + validateOnBlur: false,
  444 + allowBlank: false,
  445 + isValid: function() {
  446 + var me = this,
  447 + disabled = me.disabled,
  448 + validate = me.forceValidation || !disabled;
  449 +
  450 + if (!me.isVisible()) {
  451 + return true;
  452 + }
  453 +
  454 + return validate ? me.validateValue(me.processRawValue(me.getRawValue())) : disabled;
  455 + }
444 456 });
445 457  
446 458 this.refParamField = new Ext.form.TextField({
... ... @@ -450,6 +462,7 @@ Ext.define('amdaUI.SearchUI',
450 462 name : 'reference_param',
451 463 width: 165,
452 464 hidden: true,
  465 + allowBlank: false,
453 466 listeners: {
454 467 afterrender: function(field, eOpts ){
455 468 var paramTarget = new Ext.dd.DropTarget(field.el.dom,
... ... @@ -494,6 +507,17 @@ Ext.define('amdaUI.SearchUI',
494 507 );
495 508 },
496 509 scope: this
  510 + },
  511 + isValid: function() {
  512 + var me = this,
  513 + disabled = me.disabled,
  514 + validate = me.forceValidation || !disabled;
  515 +
  516 + if (!me.isVisible()) {
  517 + return true;
  518 + }
  519 +
  520 + return validate ? me.validateValue(me.processRawValue(me.getRawValue())) : disabled;
497 521 }
498 522 });
499 523  
... ...