PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

single line + Enable enhanced UI -> how can I limit added values?

  1. black_lady
    Member

    Hello,
    First, sorry for my English :)
    Second:
    In my form, I want create: single line with checked opion "save to taxonomies" and "Enable enhanced UI". Now users can adds many new values. I want limit added values (f.e. users can adds 3 new values), is it possible?

    Posted 12 years ago on Monday November 26, 2012 | Permalink
  2. The enhanced UI is provided by the Chosen script. As such, you can limit the number of choices by adding this JavaScript to your page:

    [js]
    <script type="text/javascript">
    jQuery(document).ready(function($) {
      $(".chzn-select").chosen({ max_selected_options: 3 })
    });
    </script>

    Ref: https://github.com/harvesthq/chosen/issues/809

    Posted 12 years ago on Tuesday November 27, 2012 | Permalink
  3. black_lady
    Member

    Hello,
    Thank You for answer,
    but it doesn't work for me, maybe I'm doing something wrong?
    JavaScript code I pasted in header.php (from my themes) in <head> section.
    In my page where I have my form still I can tape more then 3 values (in "single line"..).
    please for help

    Posted 12 years ago on Tuesday November 27, 2012 | Permalink
  4. Please post a link to the page on your site where the form is embedded so we can take a look at how you implemented the JavaScript.

    Posted 11 years ago on Thursday November 29, 2012 | Permalink

This topic has been resolved and has been closed to new replies.