tarikulcse / dropdown-check-list

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

How to handle value with DDCL #270

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Dear Sir,
I'm very happiness with your plugin but I can't handle values from it,
please help me.

Thanks

Original issue reported on code.google.com by nttoanbrvt on 9 Oct 2012 at 7:49

GoogleCodeExporter commented 8 years ago
In terms of values and form processing, you need to get your page operating 
without having DDCL active at all.  Create the SELECT and OPTIONs you want to 
use and test the page to ensure you can handle the user submission.  When your 
value processing is fully functional, then you can activate DDCL.  It should 
have no effect on how the values are submitted with the form.

FYI - in the future, please provide full details about your environment, and 
include a sample of the HTML you are working with.  

Original comment by womohun...@ittrium.com on 9 Oct 2012 at 1:43

GoogleCodeExporter commented 8 years ago
Dear Sir,
I see DDCL process with no have a name of input so I can't handle it?

With a input form normal, I can handle it, this file a custom theme on 
wordpress for test.

<div class="ui-dropdownchecklist-item ui-state-default" style="white-space: 
nowrap; ">
<input type="checkbox" id="ddcl-s5-i0" class="active" tabindex="0" index="0" 
value="coffee-chip">
<label for="ddcl-s5-i0" class="ui-dropdownchecklist-text" style="cursor: 
default; ">Coffee Chip</label>
</div>

You see, this's html after DDCL active, input checkbox have'nt a name attribute 
so can't POST it?

Many thanks for reply.

Original comment by nttoanbrvt on 10 Oct 2012 at 12:56

Attachments:

GoogleCodeExporter commented 8 years ago
I believe you have misunderstood the basic operation of DDCL.  You create a 
<SELECT> and <OPTION>s in your html, and get your server side form handling 
operating with the Select.
The DDCL generated components are not designed to be part of your form, that is 
why they have no names. Instead, any changes the user makes to the DDCL 
components are reflected in the original SELECT structure. It is still the 
original SELECT that gets submitted with the form.

Original comment by womohun...@ittrium.com on 10 Oct 2012 at 1:21

GoogleCodeExporter commented 8 years ago
Dear Sir,

    <form action="" method="post" name="dropdown">
            <select id="s5" multiple="multiple" name="dropdown_select">
                <option value="coffee-chip">Coffee Chip</option>
                <option value="cookie-dough">Cookie Dough</option>
                <option value="cookies-cream">Cookies 'n Cream</option>
                <option value="dutch-chocolate">Dutch Chocolate</option>
                <option value="butter-cup">Fudgee Peanut Butter Cup</option>
            </select>
    <input type="submit" value="submit" >
    <?php wp_nonce_field('dropdown_act','dropdown');?>
    </form>

I test with chrome, result not have dropdown_select SELECT
==> Array ( [dropdown] => f6afaecaa0 [_wp_http_referer] => /hrwebsite/dropdown/ 
)

On firefox/IE ==> Array ( [dropdown_select] => cookies-cream [dropdown] => 
f6afaecaa0 [_wp_http_referer] => /hrwebsite/dropdown/ ) 

It show one value, not multi.

How to handle multi values?

Thanks.

Original comment by nttoanbrvt on 11 Oct 2012 at 1:16

GoogleCodeExporter commented 8 years ago
Sorry, but I have no experience with PHP and cannot help you.
But are you saying you get a different result when DDCL is active versus using 
the Select when DDCL is not active?

Original comment by womohun...@ittrium.com on 11 Oct 2012 at 2:26

GoogleCodeExporter commented 8 years ago
I hope this could be useful to everybody. I have made this example (complete 
and short). My index.html is:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <title>jQuery Dropdown CheckList - TESTING</title>
    <link rel="stylesheet" type="text/css" href="smoothness-1.8.13/jquery-ui-1.8.13.custom.css">
    <link rel="stylesheet" type="text/css" href="src/ui.dropdownchecklist.themeroller.css">   
    <style>
table td { vertical-align: top }
dd { padding-bottom: 15px }
    </style>
    <script type="text/javascript" src="jquery-1.6.1.min.js"></script>
    <script type="text/javascript" src="jquery-ui-1.8.13.custom.min.js"></script>
    <script type="text/javascript" src="src/ui.dropdownchecklist.js"></script>
    <!-- Apply dropdown check list to the selected items  -->
    <script type="text/javascript">
        $(document).ready(function() {
            $("#s8").dropdownchecklist( { emptyText: "Elija de esta lista", width: 250 } );
            $("#s8a").dropdownchecklist( { emptyText: "<i> Elija de esta lista </i>", width: 250 } );
        });
    </script>
    <meta name="description" 
    content="Prueba Dropdown Check List jQuery">
</head>
<body>
<div id="content">
  <form name="form1" method="POST" action="recibe.php" >
            <span>Estado de este correo</span><br>
            <select id="s8" name="s8[]" class="s8" multiple="multiple">
                <option>Correo Leído</option>
                <option>Abrió adjuntos</option>
                <option>Respuesta automática</option>
            </select>
            <br>
            <span>Estado de este correo</span><br>
            <select id="s8a" name="s8a[]"  class="s8a" multiple="multiple">
                <option>Correo Leído</option>
                <option>Abrió adjuntos</option>
                <option>Respuesta automática</option>
            </select>
    <input type="submit" value="submit" >
  </form>
</div>
</body>
</html>

And my php file (recibe.php):

<?php 
  $s8  = $_POST['s8'];
  $s8a = $_POST['s8a'];
  echo "Se recibieron los valores: s8 <br>";
  print_r ($s8); 
  echo "<br>";
  echo "Se recibieron los valores: s8a <br>";
print_r ($s8a); 
echo "<br>";
exit(1);
?>

I have attached all necessary files in a doc.zip file.

In my example, I used two dropboxes with three options each one. In the php 
file I receive two arrays with all values selected in the index.html

Greetings to all from méxico, I hope that it should be useful.
JAD

Original comment by jorgead6...@gmail.com on 24 Nov 2012 at 7:20

Attachments: