Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
3 posts Page 1 of 1
Multiple selection (for typeahead.js or similar forms with suggestions).

Code: Select all
<div class="row">
    <div class="col-md-12">
        <div class="form-group">
            <label>State:</label>
              <select data-placeholder="Select a State..." multiple="multiple" class="select" >
                  <optgroup label="Mountain Time Zone">
                      <option value="AZ">Arizona</option>
                      <option value="CO">Colorado</option>
                      <option value="ID">Idaho</option>
                      <option value="WY">Wyoming</option>
                  </optgroup>
                  <optgroup label="Central Time Zone">
                      <option value="AL">Alabama</option>
                      <option value="IA">Iowa</option>
                      <option value="KS">Kansas</option>
                      <option value="KY">Kentucky</option>
                  </optgroup>
                  <optgroup label="Eastern Time Zone">
                      <option value="CT">Connecticut</option>
                      <option value="FL">Florida</option>
                      <option value="MA">Massachusetts</option>
                      <option value="WV">West Virginia</option>
                  </optgroup>
              </select>
          </div>
      </div>
  </div>                                                       


Add name[] to this select :
<select data-placeholder="Select a State..." multiple="multiple" class="select" name="states[]">

Add cms:input with the same name (without brackets) somewhere near (before or after):
Code: Select all
   <cms:input type='checkbox' name='states' />

without opt_values the cms:input above will not be present on page, but on server there will be a variable ready to accept POST/GET submitted data. It is also permitted to enclose it with <cms:hide></cms:hide> tags to double sure nothing is present in html code.

As a result, multiple-selected items will be available in k_success block of your cms:form as a variable frm_states: AZ, CO. cms:form full samples can be found in docs.

img-2016-05-06-13-45-51.png
img-2016-05-06-13-45-51.png (6.69 KiB) Viewed 630 times
You are really a green lantern!!!

:D :D

Bookmarked this!
As soon as possible!

Touch me up : abada[dot]zulma[at]gmail[dot]com
GoingMarryAsap wrote: You are really a green lantern!!!

:D :D

Bookmarked this!


Thanks, i can't believe it myself :D
3 posts Page 1 of 1

Who is online

In total there are 3 users online :: 0 registered, 0 hidden and 3 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 3 guests