Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
U

User 10516938

@User 10516938
About
Posts
1
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • following jquery code not working when deployed on servers
    U User 10516938

    There are different sections on the page(ASP.net MVC) with same controls(ex:phone,email). I want the following validation message to be displayed differently in Validation Summary(with section name) and beside individual text boxes(w/o section name)

    This is the validation message specified in the model
    [Required(ErrorMessage = "Chief Executive - |Name is required")]
    [Required(ErrorMessage = "Medical Director - |Name is required")]

    The code to replace the '|' symbol in jquery.validate.unobtrusive.js is

    function onError(error, inputElement) { // 'this' is the form element
    var container = $(this).find(".name) +
    "']"),
    replaceAttrValue = container.attr("data-valmsg-replace"),
    replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) !== false : null;

    container.removeClass("field-validation-valid").addClass("field-validation-error");
    error.data("unobtrusiveContainer", container);

    if (replace) {
    container.empty();
    error.removeClass("input-validation-error").appendTo(container);
    }
    else {
    error.hide();
    }

    error.text(error.text().substr(error.text().indexOf("|") + 1));
    }

    function onErrors(event, validator) { // 'this' is the form element
    var container = $(this).find(""),
    list = container.find("ul");

    if (list && list.length && validator.errorList.length) {
    list.empty();
    container.addClass("validation-summary-errors").removeClass("validation-summary-valid");

    $.each(validator.errorList, function () {
    $("").html(this.message.replace('|', '')).appendTo(list);
    });
    }
    }

    The pipe symbol is replaced with space and displayed as desired in local host. But when the code is deployed to servers, I am getting the same validation message(with section names) displayed in both validation summary and beside the text boxes also.

    I am ready to provide other code also.

    I also have this in web.config

    The Lounge javascript asp-net csharp html docker
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups