0

Is it possible to validate the Kendo UI cascading dropdownlist using jQuery validate plugin?

The rendered markup for the default HTML widget, is a group of spans but there is an input control, of type text that it binds to. I've tried using the errorPlacement callback to try and style the area affected, but this does not seem possible?

Sparky
  • 98,165
  • 25
  • 199
  • 285
JadedEric
  • 1,943
  • 2
  • 26
  • 49
  • Please read [this](http://stackoverflow.com/help/how-to-ask) and [this](http://stackoverflow.com/help/mcve). Then show us the rendered HTML structure along with what you've already tried doing with `errorPlacement`. Also explain what kind of validation you're talking about... `required` is typically all one does with a dropdown. Thanks. – Sparky Mar 05 '15 at 22:14
  • how is this an exact duplicate? i'm referring to the cascading dropdowns in HTML, and not the Razor dropdownlist (works completely different). regardless. I found a solution that's different from both answers. thanks. – JadedEric Mar 06 '15 at 14:55
  • If somebody asks you to clarify your question and show the relevant code, please indulge them. If you found something wrong with an answer, then please comment on it. If you found a better solution, then please post it as an answer. **That's what makes SO a better place for everyone**. Meanwhile, I've re-opened the question. Thanks. – Sparky Mar 06 '15 at 15:05
  • Thank you Sparky, I'm sorry you're having a bad day. Regards Eric – JadedEric Mar 06 '15 at 15:06
  • My day is going just fine. Don't be confused about motivation when people are simply expecting better quality from you here. Thanks. – Sparky Mar 06 '15 at 15:09

1 Answers1

0

Is it possible to validate the Kendo UI cascading dropdownlist using jQuery validate plugin?

The quick answer is that jQuery Validate will validate any select, textarea and input (all types with the exception of submit, button, reset and such) that are within a <form> container. It is impossible to validate any other kind of HTML element with this plugin. However, there are workarounds that involve dynamically moving the data into a hidden input element for validation.

By default, the plugin also ignores any element that is hidden by CSS or by type="hidden". The ignore option will allow you over-ride this function, and ignore: [] will simply tell the plugin to ignore nothing.

...but there is an input control, of type text that it binds to

If the data is contained within an input type="text", then you can validate it with this plugin (as long as this input has a unique name attribute). Keep in mind that if this text input is hidden, you'll have to tell the plugin not to ignore it as per the proper settings on the ignore option. (As already stated above, ignore: [] will tell the plugin to ignore nothing... to validate hidden elements.)

I've tried using the errorPlacement callback to try and style the area affected, but this does not seem possible?

We have no idea what you've tried, nor have you explained what you mean by "style the area", so it's impossible to say if anything is "possible" or if you simply did something improperly.

However, the errorPlacement option is not used to "style" anything, it's used for "placement" of the error message. There are various other options and techniques for styling.

If you want more detail regarding a certain case, then please improve the question with such information.

Sparky
  • 98,165
  • 25
  • 199
  • 285