Issue with <select> size attribute in WP.

Discussion in 'Blogging' started by Submerged, Jul 25, 2009.

  1. #1
    I'm getting a very odd result from one of my codes. Basically, if I call for a dropdown box with a size greater than 1 (and more than one option), it will still only show one option at a time but will merely create a scrollbar.

    I've tested the following code on PHP 4 and 5 and on two separate servers with a WP installation, and it has done this in each case. The odd part is that if I simply insert the <select> part into a different plug-in (I tried it with the 'hello dolly' one that comes standard) it works just fine. So I must be calling the functions wrongly or something. Anyone see anything? :) I've included a picture of a normal (size=1) dropdown and the strange result as an attachment.
    <?
    add_action('admin_menu', 'ao_addoptionpage');
    
    function ao_addoptionpage() 
    {
      add_options_page('Adsense Organizer', 'Adsense Organizer', 8, 'adsenseorganizer', 'ao_optionpagecontent');
    }
    
    function ao_optionpagecontent() 
    {
    ?>
    <select name="test" size="4">
    
    <option value="1">Option 1</option>
    <option value="2">Option 2</option>
    <option value="3">Option 3</option>
    <option value="4">Option 4</option>
    
    </select>
    <?
    }
    
    Code (markup):
     
    Submerged, Jul 25, 2009 IP