elclanrs / jq-idealforms-old

The ultimate framework for building and validating responsive HTML5 forms.
665 stars 95 forks source link

Disable styling on certain elements (disableCustom) #75

Closed authapi closed 11 years ago

authapi commented 11 years ago

Great plugin!

I just found this and I was wondering if there's a way to disableCustom to certain classes instead of the whole element/tag inside the form.

I tried using disableCustom and it works, but I just need to disable it to a particular element say with a class and using another plugin with it's own styling/code and if possible use only the validation.

elclanrs commented 11 years ago

The only element I can think of you'd want to disable conditionally is the select dropdown right? The disableCustom prevents the custom select from ever being created, but, when it is created the custom select will have a class equal to the name of the original select. Ideal Forms doesn't remove the original element it just takes it out of view, this means that you can bring it back in place, hide the custom one and then apply a new plugin if you want. In other words, assuming your select is named "foobar":

$('.ideal-select.foobar').hide(); // hide replacement
$('select[name="foobar"]')
  .css({ position: 'inherit', left: 0 }) // bring original back in place
  .customSelectPlugin() // call another plugin

Note that I haven't tried this personally but I imagine it should work. Let me know how it goes.

The validation should work with most replacement plugins. The icon and error will still show but you'll need to adjust the width of your custom select and make sure it works in responsive mode. I tried once with select2 and I found it fairly easy to adjust to Ideal Forms

authapi commented 11 years ago

Thanks! I will try this and let you know..

authapi commented 11 years ago

Yes, this is for the select dropdown.

authapi commented 11 years ago

Works great! thanks again.