Ravichndra / dropdown-check-list

Automatically exported from code.google.com/p/dropdown-check-list
0 stars 0 forks source link

if on page load item is selected, when posting null post #273

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
** What steps will reproduce the problem?
have something pre selected with selected="selected", on page load, without 
clicking on anything try to post it.

** What is the expected output? What do you see instead?

I expect for the selected default to be submitted however null is posted

** What is your environment?
-- DropDownCheckList version: 1.4
-- jQuery version: 1.6.1
-- jQuery UI version: 1.8.13
-- Browser and version: Safari Version 6.0.2 (8536.26.17)

** Please provide any additional information below/Please attach sample
html

<script type="text/javascript">

        $(document).ready(function() {
            $returnS5 = $('#returnS1');
            $("#s1").dropdownchecklist({ 
                emptyText: "Affilation Filter", 
                width: 300,
                firstItemChecksAll: true 
            });

            $('select option').removeProp('selected');

       });
    </script>
    </head>
    <body>

        <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
    <select id="s1" multiple="multiple" name="rawr[]">
        <option value="all" selected="selected">All</option>
        <option value="undergraduate">Undergraduate</option>
        <option value="graduate">Graduate</option>
        <option value="faculty">Faculty</option>
        <option value="staff">Staff</option>
        <option value="affiliate">Affiliate</option>
    </select>
    <br><br>
    <br>
    <input type="submit">
    </form>

<?php
 if(isset($_POST['rawr']))
    echo var_dump($_POST['rawr']);
?>

Original issue reported on code.google.com by icatc...@gmail.com on 20 Nov 2012 at 2:49

GoogleCodeExporter commented 9 years ago
nvm I fixed it!

I just had to remove : $('select option').removeProp('selected');

Original comment by icatc...@gmail.com on 20 Nov 2012 at 3:10

GoogleCodeExporter commented 9 years ago

Original comment by womohun...@ittrium.com on 28 May 2013 at 8:26