Server side error not shown client side

4 posts, 0 answers
  1. Indicia
    Indicia avatar
    12 posts
    Member since:
    Mar 2012

    Posted 07 May 2015 Link to this post

    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>

  2. Indicia
    Indicia avatar
    12 posts
    Member since:
    Mar 2012

    Posted 07 May 2015 in reply to Indicia Link to this post

    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.

  3. Kendo UI is VS 2017 Ready
  4. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 11 May 2015 Link to this post

    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!
     
  5. Indicia
    Indicia avatar
    12 posts
    Member since:
    Mar 2012

    Posted 11 May 2015 in reply to Rosen Link to this post

    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] }));
Back to Top
Kendo UI is VS 2017 Ready