• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[WORKED AROUND] Passing a checkbox array... Nerve-racking.

#4
[eluser]Morty[/eluser]
I had to send an imploded version of my checkboxes then exploded via the PHP script.

JS :

Code:
function inline_results() {
    $filterstring = '';

    // alert(Form.serialize($('filter[]')));

    res = document.getElementsByName('filter[]')
    $filterstring = '';

    for (i = 0; i < res.length; i++)
        if (res[i].checked == true)
            if ($filterstring == '')
            {
                $filterstring += res[i].value;
            }
            else
            {
                $filterstring += '|'+res[i].value;
            }

    new Ajax.Updater ('stock_values', base_url+'stocks/ajaxstocksearch', {method:'post', postBody:'stock_site='+$F('stock_site')+'&stock;_product='+$F('stock_product')+'&filter;='+$filterstring});

With a simple :

Code:
$filter = explode("|", $filter);

to give back the array. I am not quite satisfied with the result, because an empty array/string is not really a FALSE boolean, but it will save me from drowning in despair.


Messages In This Thread
[WORKED AROUND] Passing a checkbox array... Nerve-racking. - by El Forum - 08-02-2007, 07:58 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.