{combine_script id='jquery.selectize' load='footer' path='themes/default/js/plugins/selectize.min.js'} {combine_css id='jquery.selectize' path="themes/default/js/plugins/selectize.{$themeconf.colorscheme}.css"} {footer_script} jQuery(document).ready(function() { jQuery("select[name=who]").change(function () { checkWhoOptions(); }); checkWhoOptions(); function checkWhoOptions() { var option = jQuery("select[name=who] option:selected").val(); jQuery(".who_option").hide(); jQuery(".who_" + option).show(); } jQuery(".who_option select").selectize({ plugins: ['remove_button'] }); jQuery("form#categoryNotify").submit(function(e) { var who_selected = false; var who_option = jQuery("select[name=who] option:selected").val(); if (jQuery(".who_" + who_option + " select").length > 0) { if (jQuery(".who_" + who_option + " select option:selected").length > 0) { who_selected = true; } } if (!who_selected) { jQuery(".actionButtons .errors").show(); e.preventDefault(); } else { jQuery(".actionButtons .errors").hide(); console.log("form can be submited"); } }); }); {/footer_script} {html_style} .who_option { margin-top:5px; } span.errors { background-image:none; padding:2px 5px; margin:0; border-radius:5px; } {/html_style}