Override jQuery validation message with custom message

36
July 20, 2018, at 11:20 PM

In my model I have a nullable int object.. and in my view.. if a checkbox is checked then I want that nullable int object to be required.

Here is my jQuery:

$(document).ready(function () {
    $("#Vcap-Checkbox").change(function() {
        if ($(this).is(":checked")) {
            $("#VcapOptionId").attr('required', "The VCAP Checkbox is checked!  Please select a VCAP Option!");
            $("#Vcap-Select").show();
        } else {
            $("#VcapOptionId").removeAttr('required');
            $("#VcapOptionId").val('').change();
            $("#Vcap-Select").hide();
        }
    });
})

Now, this is working when making the object required.. however, I would like a more descriptive error message if the user tries to submit the form when the checkbox is checked without selecting a VcapOptionId.

Any help is appreciated.

READ ALSO
Get the number of click counts and call a single ajax call using jquery

Get the number of click counts and call a single ajax call using jquery

I need to call ajax service when the user continuously clicks a link but Now I have written for a single clickOnce clicked ajax called and works fine but continuously clicks means takes only the first click alone

38
Disable and enable multiple option tag

Disable and enable multiple option tag

I want to disable and enable my option tag value using jQueryI tried it but I didn't get solution

38
Print IFrame content generated dynamically

Print IFrame content generated dynamically

I am trying to print a HTML page in IFrame generated dynamically, with this code bellow:

34
Jquery Datatable - AJAX- No records handler

Jquery Datatable - AJAX- No records handler

I am loading data into my datatable using ajaxThis is the code:

10