10 Answers, 1 is accepted
0
Hello Oscar,
You may add additional validation rules which to be executed during Grid editing through the model definition. For example:
Regards,
Rosen
the Telerik team
You may add additional validation rules which to be executed during Grid editing through the model definition. For example:
new
kendo.data.DataSource({
//.....
schema: {
model: {
id:
"ProductID"
,
fields: {
//....
ProductName: {
validation: {
required:
true
,
maxlength:
function
(input) {
if
(input.val().length > 5) {
input.attr(
"data-maxlength-msg"
,
"Max length is 5"
);
return
false
;
}
return
true
;
}
}
}
}
}
}
});
Regards,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Oscar
Top achievements
Rank 1
answered on 15 Feb 2012, 11:07 AM
Hello Rosen:
Thanks for your help.
One last question:
Is there a way to set the attribute maxLength of the <input> to specify the maximum number of characters allowed for editing that cell?
Thanks for your help.
One last question:
Is there a way to set the attribute maxLength of the <input> to specify the maximum number of characters allowed for editing that cell?
1
Accepted
Hello Oscar,
All the best,
Rosen
the Telerik team
You should use Grid's edit event to apply the attribute to the appropriate input.
$(
"#grid"
).kendoGrid({
dataSource: dataSource,
editable:
true
,
edit:
function
(e) {
e.container.find(
"input[name=ProductName]"
).attr(
"maxlength"
, 5);
},
//....
});
All the best,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
jc mag
Top achievements
Rank 1
answered on 29 Feb 2012, 08:02 PM
It would be great to have the maxLength validation function built in your datasource component ;)
0
Loganathan
Top achievements
Rank 1
answered on 18 Apr 2012, 10:30 AM
Hi
i have problem similar like this,
How can I validate dropdownlist when editing a cell?
Help me!
0
Matthew
Top achievements
Rank 1
answered on 27 Dec 2012, 03:44 PM
In reference to this solution:
It appears the maxlength function is being executed for every input element within the table row (in edit mode), instead of just the input for the field specified.
Is this the intended behavior?
Regards,
Matthew Sweeney
new
kendo.data.DataSource({
//.....
schema: {
model: {
id:
"ProductID"
,
fields: {
//....
ProductName: {
validation: {
required:
true
,
maxlength:
function
(input) {
if
(input.val().length > 5) {
input.attr(
"data-maxlength-msg"
,
"Max length is 5"
);
return
false
;
}
return
true
;
}
}
}
}
}
}
});
It appears the maxlength function is being executed for every input element within the table row (in edit mode), instead of just the input for the field specified.
Is this the intended behavior?
Regards,
Matthew Sweeney
0
Sampath
Top achievements
Rank 1
answered on 03 Nov 2014, 11:00 AM
hi,
how can I achieve the same functionality if I were to use ASP.NET MVC (Razor syntax). Can you please provide that as well?
how can I achieve the same functionality if I were to use ASP.NET MVC (Razor syntax). Can you please provide that as well?
0
Hi Sampath,
Information on how to implement custom validation using Kendo UI Validator in the context of ASP.NET MVC can be found in this help article.
Regards,
Rosen
Telerik
Information on how to implement custom validation using Kendo UI Validator in the context of ASP.NET MVC can be found in this help article.
Regards,
Rosen
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
asad
Top achievements
Rank 1
answered on 16 Jul 2016, 09:21 AM
dear Rosen i have a Time Format like this 234:00 how i validate it when i enter more then 3 value before colon its cant enter and same as i enter 2 value before colon its cant enter in kendo grid field
0
Hi asad,
I'm afraid I did not understood your question. In case you need a custom validation rule you should check this help article on how to implement such. Otherwise, you should open a separate support request in which to provide as much details about what is the actual problem as possible. Also a simplified test page which to demonstrate the issue you are having will be appreciated.
Regards,
Rosen
Telerik by Progress
I'm afraid I did not understood your question. In case you need a custom validation rule you should check this help article on how to implement such. Otherwise, you should open a separate support request in which to provide as much details about what is the actual problem as possible. Also a simplified test page which to demonstrate the issue you are having will be appreciated.
Regards,
Rosen
Telerik by Progress
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.