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

Validator templates bug in custom editor

5 Answers 43 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vladimir
Top achievements
Rank 1
Vladimir asked on 07 Feb 2019, 01:28 PM

Hi,

Im use datePicker and comboBox inside my grid with required attribute and i have bug with validation template, if you go to this dojo https://dojo.telerik.com/OzojoLed and change 

"function categoryDropDownEditor(container, options) {
                    $('<input required name="' + options.field + '"/>')
                        .appendTo(container).kendoDropDownList" to .kendoComboBox, then delete value and call validation, it is displayed incorrectly, how i can fix it?

5 Answers, 1 is accepted

Sort by
0
Vladimir
Top achievements
Rank 1
answered on 07 Feb 2019, 01:51 PM
I think problem with tooltip element inside <span>, but i don't know how i can fix it
0
Viktor Tachev
Telerik team
answered on 11 Feb 2019, 08:44 AM
Hello Vladimir,

In order to position the validation tooltip you can include a span element with k-invalid-msg CSS class as described in the Customization of Tooltip position article. Check out the updated dojo sample below for illustration:



Regards,
Viktor Tachev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Vladimir
Top achievements
Rank 1
answered on 12 Feb 2019, 08:32 AM
[quote]Viktor Tachev said:Hello Vladimir,

In order to position the validation tooltip you can include a span element with k-invalid-msg CSS class as described in the Customization of Tooltip position article. Check out the updated dojo sample below for illustration:

Regards,
Viktor Tachev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.

[/quote]

Thanks, it's worked now, but i have emerging problem with displaying multiple validations.

I need all validation templates to be displayed at the bottom of the input.

What i have: 

Input with "required" attribute and custom message for that input:

<input class="form-control" name="replaceableUser" id="replaceableUser" required validationMessage="Choose user.">

 

then i use two <span> for templates below input

<span class="k-invalid-msg" data-for="replaceableUser"></span>
<span class="k-invalid-msg" data-for="replaceableUser_input"></span>

 First shows required validationMessage="Choose user."

Second shows my custom validation

$("#replacementForm").kendoValidator({
    // validateOnBlur: true,
    rules: {
            if (input.is("[name=replaceableUser]")) {
                console.log("value: " + input.val());
                console.log("index: " + $("#replaceableUser").data("kendoComboBox").selectedIndex);
                if (input.val() != "" & $("#replaceableUser").data("kendoComboBox").selectedIndex !=
                    -1) {
                    if (input.val() == 148496) {
                        console.log("ок");
                        return input.val() == 148496;
                    }
                }
                return true;
            }
        }
    },
    messages: {
        invalidUser: "Choose user from list."
    }
});     
0
Vladimir
Top achievements
Rank 1
answered on 12 Feb 2019, 08:40 AM

Sorry send incomplete message.

First problem:

When i focusing <input> and then focus another element or empty space both validations are displayed simultaneously.

How i can first displaying "required" validation for empty value, and then displaying second custom validation for invalidUser? (consistently)

 

And my custom message does not disappear, although the function ends on the block

return input.val() == 148496;

 

I would also like to do such checks on the grid, there is the same combo box, but for now I'm stuck on the usual input :(

0
Accepted
Viktor Tachev
Telerik team
answered on 14 Feb 2019, 07:26 AM
Hi Vladimir,

When there are multiple custom rules defined in the Validator they will run in order. Validation will stop at the first rule that fails and display the validation message specified for that rule. For more information on using custom validation rules check out the article below:



Regards,
Viktor Tachev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Vladimir
Top achievements
Rank 1
Answers by
Vladimir
Top achievements
Rank 1
Viktor Tachev
Telerik team
Share this question
or