Robdel12 / DropKick

A JavaScript plugin for creating beautiful, accessible, and painless custom dropdowns.

Home Page:http://dropkickjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using DropKick with form validation.

benlevydesign opened this issue · comments

Is it possible to use DropKick with form validation. See the form on my website where I have two select elements. Without using dropkick they would normally get validated. I am using jqueryvalidation to do my validation.

Hey Ben,

By default, Dropkick hides original select elements with display: none. There's an option for .validate() called ignore which defaults to ":hidden". This means that it is ignoring the original select elements, and since Dropkick isn't a normal form control, no validation is being performed on them.

You have 2 possible solutions:

  1. Hide the original select elements another way.
  2. Override the default ignore option.

Hope this helps!

This what I ended up doing and it works as should!

ignore: {
  hidden:"not(.selectoptions)",
  hidden:"not(textarea.tinymce)"
},

I also added tinymce to my textarea form field. It hides the original textarea form field so, you need to include textarea.tinymce in the same do not ignore option.

Thanks!