Telerik Forums
Kendo UI for jQuery Forum
1 answer
49 views

Someone should really update the documentation to indicate in which version new features were added. Not everyone is running the very latest version.

My company is using UI for ASP.Net MVC version 2019.3. (2020.2 is currenlty being evaluated)

Is my assumption correct that "validationSummary: true" in validator was NOT added until version 2020 R2?

I spent hours trying to figure out why this was not working with 2019.3? :)

Martin
Telerik team
 answered on 14 Jul 2020
9 answers
884 views

I'm building my form dynamically and it can have checkboxes, textboxes, radio buttons, etc. is it possible to connect the validator to those dynamically? Each control will have [required] attach to it, if it's set as a required field by the users when building the form.

so for example:

<div id="container">
 <input type="text' id="new" required/>
 
<br>
<select id="ddSalesman" >
   <option>select one</option>
</select>
 
<input type="checkbox" id="NewOrUsed" required>
</div>

and so on, is there a way to connect the validator to these controls when the users clicks the button?

Petar
Telerik team
 answered on 26 May 2020
1 answer
269 views

Hello,

I have this valdiation summary:

<div asp-validation-summary="All" class="text-danger" >
    <span class="k-invalid-msg" data-for="Description" data-valmsg-for="Description"
        id="Description_validationMessage" role="alert" >
     </span>
        ... more fields
</div>
 
<textarea asp-for="Description" class="form-control mc0" data-bind="value: ent.Description">
</textarea>

 
let viewModel = kendo.observable({
 
    save: function() {
        let editForm = $("#edit-form").kendoValidator().data("kendoValidator");
 
        if (editForm.validate()) {
          this.entDataSource.sync();
    }
    },
})

 

Because of the business rules, I need to validate only certain fields, based on the current entity state.

Is there a way to validate only certain fields, like all fields with class "mc0" (or fields in a "div#id-for-state-X") and have the error messages displayed in the summary?

Thanks.

Petar
Telerik team
 answered on 24 Feb 2020
10 answers
2.0K+ views
I posted the following question on StackOverflow, but got no response.  

So I will try here:

I am attempting to use KendoUI Validator with an ASP.NET WebForms project. I have a simple page, that has a number of inputs, and of course ASP.NET adds some hidden form elements as well.

I have the following questions:

  1. Why does the KendoUI Validator not ignore hidden form fields, and how to I get it to?
  2. Why does KendoUI apply the rules to every input field, and how to do get it to ignore some fields. I want a declarative way to do this, not by adding all sorts of exceptions in my validation rule, as per the example in the KendoUI Validator API page.
  3. Shouldn't it be that if no rule is set as an attribute in the input element (eg; required) then no validation is applied?
Behavior I am getting:
  • With no validation specific attributes on the input element at all, the validation rules still get applied when I call .validate()
  • Hidden form elements are validated.
I am using the following kendo:

http://cdn.kendostatic.com/2013.2.716/js/jquery.min.js
http://cdn.kendostatic.com/2013.2.716/js/kendo.all.min.js
http://cdn.kendostatic.com/2013.2.716/styles/kendo.common.min.css
http://cdn.kendostatic.com/2013.2.716/styles/kendo.default.min.css

I have put together a fiddle that demonstrates this: 
http://jsfiddle.net/codeowl/B5ML4/3/

And here is the code, for those that don't have access to fiddle, I have the following markup:
<form action="/" id="testForm">
    <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
    <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
 
    <input type="text" id="testInput" value="">
    <a id="testValidate" href="javascript:;">Validate</a>
</form>

and the following script:
var validatable = $("#testForm").kendoValidator({
    rules: {
        testRule1: function (input) {
            // Only "Tom" will be a valid value for the FirstName input
            return input.is("[name=firstname]") && input.val() === "Tom";
        },
        testRule2: function (input) {
            return $.trim(input.val()) !== "";
        }
    },
    messages: {
        testRule1: "Your name must be Test",
        testRule2: "Your name must be Foo"
    }
}).data("kendoValidator");
 
$("#testValidate").click(function () {
    if (validatable.validate()) {
        alert('passed');
    }
});

and when I press the validate link it shows validation messages for the hidden fields.
Petar
Telerik team
 answered on 01 Nov 2019
1 answer
829 views

I have a checkbox group and only want to make sure what is checked if required.It's validating all checkboxes, I only to validate the group is required.

this creates textboxes on the page, and it can be 1 or many, however, if x.Required is true, I only want to validate the group not each checkbox. Is that possible with the validator or no, if not, can I remove the checkboxes from the validator since they have an input tag with textboxes?

foreach(var x in group)
{
       <input type="checkbox" name="@x.Location" value="@x.Text" required="@x.Required"/>
}
Veselin Tsvetanov
Telerik team
 answered on 30 Sep 2019
1 answer
253 views

Hello,

I'm trying to customize a span element to look like a validation popup with the arrow on top pointing to an input element.  I am not able to use validation in this case, and I'm trying to display a tooltip instead.  I have the following:

<span id="validation" class="k-widget k-tooltip k-tooltip-validation k-x-invalid-msg-block"></span>

 

The code above almost works, however, the little directional arrow on top of the span is not displayed.  If I include 'k-callout' and 'k-callout-n' then the entire span moves and is distorted.  Can anyone help me get the little arrow to show up?   Any help is appreciated. Thanks!

Eyup
Telerik team
 answered on 20 Jun 2019
3 answers
733 views
   $("#myform").kendoValidator({

            rules:
                {
   
                    json_rule: function (input) {
                        var ret = true;
                        if (input.is("[id=pwd]")) {
                            $.ajax({
                                url: "api/HelperApi/Test" ,
                                type: 'Get',
                                data: { value: input.val() },
                                success: function (result) {
                                    ret = result === true;
                                }
                            });
                        }
                        return ret;
                    }

                },

            messages: {

                json_rule: "Json verified!",
    
       
            }
        });

I never see the message for some reason (I verified the server call, it does return true and false)
Will
Top achievements
Rank 1
 answered on 21 Mar 2019
3 answers
166 views

I have an issue when using server side validation with the Kendo validator. When the input has focus, the server side validation seems to occur 3-4 times per second hitting the server. This only happens when there is an error, and the server returns false (something was not validated correctly). The server side validation occurs rapidly after that and it seems to slow down the browser, and when the user corrects the value and clicks on the submit button, the browser stops processing and freezes until you hit the submit button again. The browsers performance is degraded as well. 

Can I slow down how often I hit the server when there was an error? Any suggestions would be welcome.

The approach that I developed is at http://gregoryalexander.com/blogCfc/client/index.cfm/2019/3/1/Kendo-Server-Side-Validation. 

Hit the comment button on this thread, make a mistake on the captcha text, fix it to replicate.

Dimitar
Telerik team
 answered on 05 Mar 2019
2 answers
5.4K+ views
My validation messages are floating over the datetime control. Beneath the dropdownlist and right next to input controls. Is there a way to set the position of the controls?
Tsvetomir
Telerik team
 answered on 29 Jan 2019
1 answer
228 views

Is it possible to have multiple validator initializations on different div tags?  Basically I'm wanting to do a wizard (without the use of the progress bar) and I want to validate one div tag per "next" button.

    function ShowSection2()
    {
        //validation
        var validator = $("#Section1").kendoValidator().data("kendoValidator");
        if (!validator.validate())
        {
            return;
        ...

 

    function ShowSection3()
    {
        //validation
        var validator = $("#Section2").kendoValidator().data("kendoValidator");
        if (!validator.validate())
        {
            return;
        ...

Ivan Danchev
Telerik team
 answered on 07 Jan 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?