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

[Solved] Broken Slider in IE8 with jquery validation

3 Answers 88 Views
Slider
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Deyan
Top achievements
Rank 1
Deyan asked on 15 Feb 2012, 04:56 PM
We are using your latest Slider with jquery-1.7.1 and jQuery Validation Plugin 1.9.0.
The slider is in tabstrip and when submitting, the form is not valid with error 
"Въведеното число трябва да е между NaN и NaN".
 Declaration of Sliders is :
 @(Html.Telerik().Slider<int>()
              .Name(ViewData.TemplateInfo.HtmlFieldPrefix)
              .Min(4)
              .Max(20)
              .SmallStep(5)
              .LargeStep(10)
              .Orientation(SliderOrientation.Horizontal)
              .TickPlacement(SliderTickPlacement.TopLeft)
              .ShowButtons(true)
              .Value(Model)
              )
The problem is only with IE.

3 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 17 Feb 2012, 02:26 PM
Hi Deyan,

I tried to reproduce your case, but to no avail. It would be best if you could send a working demo that could be examined in closer details. Please provide such project and we will check it right away.

Thank you in advance.

All the best,
Alexander Valchev
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Dmitry
Top achievements
Rank 1
answered on 11 Mar 2012, 04:35 PM
I have the same issue with Slider in IE9.

It is not easy to send complete solution, but in my case we have clien-side wizard(slider is on the first page) with JQuery validation call on clicking "Next/Submit" button.
$("#next-step").click(function () {
 
    var $step = $(".wizard-step:visible"); // get current step
 
    var validator = $("form").validate(); // obtain validator
    var anyError = false;
 
    var validableElements = $.merge($step.find("input"), $step.find("textarea"));
    validableElements.each(function () {
        if (!validator.element(this)) { // validate every input element inside this step
            anyError = true;
        }
    });
 
    if (anyError)
        return; // exit if any error found
 
    if ($step.next().hasClass("wizard-step")) { // is there any next step?
        $step.hide().next().fadeIn(); // show it and hide current step
        //                $("#back-step").show(); // recall to show backStep button
        showWizardButtons();
    }
});

The issue is in the code:
if (!validator.element(this)) { // validate every input element inside this step
      anyError = true;
  }

Slider input returns false in IE9, although i can't imaging invalid state for slider :-)
0
Alexander Valchev
Telerik team
answered on 14 Mar 2012, 04:54 PM
Hi Dmitry,

I believe the problem is caused by the jQuery validator behaviour - it returns false if the browser does not support range type inputs. A possible solution is to ignore slider inputs through the validator settings. For example:
$(document).ready(function () {
    var validator = $('form').data('validator');
    validator.settings.ignore = '[type=range]';
});

I hope this information will help you to solve the problem.

All the best,
Alexander Valchev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
Tags
Slider
Asked by
Deyan
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Dmitry
Top achievements
Rank 1
Share this question
or