This question is locked. New answers and comments are not allowed.

Joan Vilariño
Top achievements
Rank 2
Joan Vilariño
asked on 14 Apr 2010, 09:46 AM
Hello... I'm binding a boolean column in an ajax editable grid.
When I enter edit mode for any row, if I leave the checkbox for that field unchecked I can't Update because there is a checkbox validator telling me that field is required even if I didn't place any validation on that field.
Is there any way to workaround this?
7 Answers, 1 is accepted
0
Hello Joan VilariƱo,
Check this forum thread for a solution.
Best wishes,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Check this forum thread for a solution.
Best wishes,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0

Joan Vilariño
Top achievements
Rank 2
answered on 15 Apr 2010, 03:37 PM
Maybe i didn't explain myself quite well.
I'm not having trouble setting the value of the checkbox at bind time. The problem is that in order to make an "Update" the checkbox MUST be checked since the grid automatically places a Required validator.
If I edit the row and leave the checkbox cleared, I can't update the record and I get the message "The field xxxxx is required" from a validator I haven't created.
Even when I make an Insert, I have the same behavior if I leave the checkbox unchecked.
Thanks!
0
Hello Joan VilariƱo,
Perhaps you didn't read all post in that thread. The last one describes why this problem occurs and how to overcome it.
All the best,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Perhaps you didn't read all post in that thread. The last one describes why this problem occurs and how to overcome it.
All the best,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0

Joan Vilariño
Top achievements
Rank 2
answered on 15 Apr 2010, 04:06 PM
Ok.. it was my fault as I didn't see that last post, anyway, could you please specify what lines do I have to change in telerik.grid.editing.js instead of giving me that .min file?
I want to have the normal .js file in case I need to debug anything..
Thanks!
0
Hello Joan VilariƱo,
Patch the validation function like this:
validation: function() {
if (window.mvcClientValidationMetadata) {
var formId = this.formId();
var metadata = $.grep(window.mvcClientValidationMetadata, function(item) {
return item.FormId == formId;
})[0];
if (metadata) {
// filter required fields for boolean columns
metadata.Fields = $.grep(metadata.Fields, $.proxy(function(rule) {
var column = this.columnFromMember(rule.FieldName);
return !column || column.type != 'Boolean';
}, this));
__MVC_EnableClientValidation(metadata);
}
}
}
Sincerely yours,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Patch the validation function like this:
validation: function() {
if (window.mvcClientValidationMetadata) {
var formId = this.formId();
var metadata = $.grep(window.mvcClientValidationMetadata, function(item) {
return item.FormId == formId;
})[0];
if (metadata) {
// filter required fields for boolean columns
metadata.Fields = $.grep(metadata.Fields, $.proxy(function(rule) {
var column = this.columnFromMember(rule.FieldName);
return !column || column.type != 'Boolean';
}, this));
__MVC_EnableClientValidation(metadata);
}
}
}
Sincerely yours,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0

Joan Vilariño
Top achievements
Rank 2
answered on 28 May 2010, 04:03 PM
Hi again... this issue is fixed. But today I've found an issue with MVC2 that is driving me crazy. I know it's not Telerik's stuff but since you solved me this one, maybe it's related and you save my day.
I have some checkboxes in a form, which represent "bool" (not nullable) values from a viewmodel. I render them with Html.CheckBoxFor(o=>o.myBoolField); and they render ok as checkboxes.
I'm validating form serverside, with a TryUpdateModel and checking right after that ModelState to see what fields failed validation... and I found that checkboxes ALWAYS fail validation if they're not checked, marking them as "required"... I think it's cause at the ModelState the value that comes for an unchecked checkbox is "" instead false.
Can you give me any hint?
Thanks!!
0

Nick
Top achievements
Rank 1
answered on 21 Dec 2011, 03:07 PM
I'm having a similar issue but i think the cause is different.
I have this column in a grid that is ajax bound.
I have this column in a grid that is ajax bound.
columns.Bound(o => o.Included)
.ClientTemplate("<input type='checkbox' <#= Included? checked='checked' : '' #> disabled='disabled' name='Included' />")
.Title("Select").Width(75).HtmlAttributes(new { style = "text-align:center" });
When save is clicked on the row, I'm seeing this is the request.
{Included.Included=true&Quantity=1&OrderDetailId=21&id=21&AuthorizationId=-1&page=1&size=10&groupBy=&filter=&orderBy=&aggregates=}
Why is Included.Included being passed? I would expect to see Included=true&Quantity=1...
The Included property is a bool.
The checkbox is being rendered in the grid as
<input id="Included_Included" type="checkbox" value="true" name="Included.Included">
This seems to have been caused by the use of an editor template for bool. However if i remove the template, then the checkbox disappears when the row is put into edit mode. How do I prevent this?
Thanks,
Thanks,