This is a migrated thread and some comments may be shown as answers.

kendoComboBox Validation before Save

4 Answers 309 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Henri
Top achievements
Rank 1
Henri asked on 29 Jan 2019, 02:07 PM

Dear Telerik,

 

I have a Kendo Grid with a kendoComboBox column.
The kendoComboBox is filled with remote JSON-Data and the input's 'required'-property is added. ('<input required ).
The validation of the required property is working, but only after I first focused the combobox-column or I first selected the combobox.
When I do not touch the combobox-column and click the save-button immediately, the validation is not done and the server gets an empty value.

Is there a way to validate and display the required message underneath the combobox after pressing the save button ?

Regards,

Henri

 

4 Answers, 1 is accepted

Sort by
0
Tsvetomir
Telerik team
answered on 31 Jan 2019, 12:16 PM
Hi Henri,

Based on the provided information, I assume that the used edit mode is "InCell", am I correct? If so, the reason why the validation is not triggered is that the validator depends on an input element and triggers the validation based on the value of the input. When "InCell" edit mode is used, there are no inputs rendered. The validation will be triggered once the cell has been opened for editing. 

That said, the validation has to be handled manually in the saveChanges event of the grid. An example of how this can be achieved can be found here:

https://dojo.telerik.com/ifezAJut

In comparison, if you make use of the "InLine" edit mode, the validation would be triggered as expected because all of the cells are opened for editing:

https://dojo.telerik.com/ovERifel


Kind regards,
Tsvetomir
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Henri
Top achievements
Rank 1
answered on 05 Feb 2019, 05:07 PM

Dear Tsvetomir,

thx for the exemple, but I have one issue ?

My Compiler generates an error on de 'raw'-array -> Errormessage = 'raw' is not defined  no-undef
The Raw-Array is used in de .Reduce-Part.
Should it be replaced with 'rawCustomRules' ?

 

thx,

Gert

 

 .reduce((obj, key) => {
                                        obj[key] = raw[key];
                                        return obj;
                                    }, {});

0
Henri
Top achievements
Rank 1
answered on 07 Feb 2019, 10:36 AM

Dear Telerik,

can you please have a look at the compile-error (raw' is not defined  no-undef)  in the Dojo Exemple https://dojo.telerik.com/ifezAJut
Line 106     obj[key] = raw[key]; 

Thx,

Henri



0
Accepted
Tsvetomir
Telerik team
answered on 07 Feb 2019, 02:53 PM
Hi Henri,

The error is expected if strict mode is enabled or JSLint is used for checking the code. This is because on row 106 a row variable is used. However, it is not defined in the code and that will result in an error. 

In the provided Dojo I have not used a custom rule which means that the comparison would not happen, hence, not throwing an exception. It is a typo and the actual comparison has to happen against the "rawCustomRules" collection.


.reduce((obj, key) => {
  debugger;
    obj[key] = rawCustomRules[key];
    return obj;

 
Kind regards,
Tsvetomir
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Henri
Top achievements
Rank 1
Answers by
Tsvetomir
Telerik team
Henri
Top achievements
Rank 1
Share this question
or