Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to select multiple value in dropdown without checkboxes?

    How to select multiple value in dropdown without checkboxes?

  • #2
    New Coder
    Join Date
    Feb 2007
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hoping this help:

    <select size="1" name="D1">
    <option value="a">a</option>
    <option value="b">b</option>
    <option value="c">c</option>
    </select>

  • #3
    New Coder
    Join Date
    Aug 2012
    Posts
    11
    Thanks
    0
    Thanked 1 Time in 1 Post
    The point of a dropbox (<select>) is that the user can only select 1 item/option. You could try making some custom JavaScript & CSS dropbox that records items you've clicked on.

  • #4
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Precisely! Then hold the control button on your keyboard to select as many as you want. If you care to keep the code up to date use:

    <select name="somename" multiple="multiple">

    And, if I'm not mistaken, you need to add an empty set of brackets to the name of the select:

    <select name="somename[]" multiple="multiple">

    Without the brackets you will only get the value of the last selected option. The brackets force the value to be an array, which can be accessed by:

    foreach($_POST['somename'] as $val) {
    print $val;
    }
    Last edited by WA; 08-29-2012 at 08:37 PM.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •