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

Server side error not shown client side

3 Answers 153 Views
Validation
This is a migrated thread and some comments may be shown as answers.
Indicia
Top achievements
Rank 1
Indicia asked on 07 May 2015, 07:22 AM

Hi, 

I'm trying to get my Custom serverside error to work, but it won't show up in the interface.

Json.png shows the response with the JSON errors, in this request I have tested the Address field (Host on Part2.png). As you can see this is empty, but the other message on Constraint is shown. (Part1.png)

 If I look at the html, I see the first error message. What could it be that it is hiding the error message?

The HTML part of the address: 

<div class="editor-field ce-channel ce-ftpchannel ce-mailchannel ce-receivechannel ce-sendchannel" style="display: block;">    <input class="k-textbox" data-val="true" data-val-required="The Host field is required." id="ChannelConfigurationViewModel_address" name="ChannelConfigurationViewModel.address" data-bind="value:ChannelConfigurationViewModel.address">    <div class="k-widget k-tooltip k-tooltip-validation k-invalid-msg field-validation-error" style="margin: 0.5em; display: none;" data-for="ChannelConfigurationViewModel.address" data-valmsg-for="ChannelConfigurationViewModel.address" id="ChannelConfigurationViewModel.address_validationMessage" role="alert"><span class="k-icon k-warning"> </span>The Host field is required.<div class="k-callout k-callout-n"></div></div></div>

3 Answers, 1 is accepted

Sort by
0
Indicia
Top achievements
Rank 1
answered on 07 May 2015, 07:28 AM

Update: If I toggle the .k-invalid-msg to be disabled the error will be shown.

.k-invalid-msg { displaynone; }
It looks like the update isn't updating the error messages correctly.

0
Rosen
Telerik team
answered on 11 May 2015, 07:21 AM

Hello,

As you may know the server-side ModelState errors will not be shown automatically. Instead, the developer should handle the DataSource error event and display them where appropriate. Here you can find a how-to sample which demonstrate handling ModelState errors in Grid using popup editing.

Regards,
Rosen
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Indicia
Top achievements
Rank 1
answered on 11 May 2015, 11:45 AM

Hello,

 In the example you provide there is the same error. We have resolved it the following:

Example: 

container.find("[data-valmsg-for=" + name + "],[data-val-msg-for=" + name + "]")
         .replaceWith(validationMessageTmpl({ field: name, message: errors[0] }))

Our fix (notice the single quotes:

container.find("[data-valmsg-for='" + name + "'],[data-val-msg-for='" + name + "']")
    .replaceWith(fieldValidationErrorMessageTemplate({ field: name, message: errors[0] }));

Thanks for looking into it!

container.find("[data-valmsg-for='" + name + "'],[data-val-msg-for='" + name + "']")
    .replaceWith(fieldValidationErrorMessageTemplate({ field: name, message: errors[0] }));
Tags
Validation
Asked by
Indicia
Top achievements
Rank 1
Answers by
Indicia
Top achievements
Rank 1
Rosen
Telerik team
Share this question
or