[support] Tableselect in forms issue

Metzler, David metzlerd at evergreen.edu
Thu Sep 13 15:13:45 UTC 2012


Seems like it should work provided you really meant $index to be $key.
That's not in your real code, right? If it is in your cod that way,
that's the bug. 

 

________________________________

From: support-bounces at drupal.org [mailto:support-bounces at drupal.org] On
Behalf Of Kamal Palei
Sent: Thursday, September 13, 2012 5:32 AM
To: support at drupal.org
Subject: [support] Tableselect in forms issue

 

Hi All

I am trying to use tableselect in forms as per below code.

 

    $form['category_boundary']['category_fieldset']['catg'] = array
          (
          '#type' => 'tableselect',
          '#header' => $header,
          '#options' => $options,
          '#multiple' => TRUE,
          '#js_select' => FALSE,
          );

 By manipulating options array, I can add the rows in forms table.

 

Sometimes I need to remove the selected rows from form table.

My question is, how can I determine if a particular row is selected.

 

Currently using below code to determine which row is selected.

 

 
foreach($form_state['values']['category_boundary']['category_fieldset'][
'catg'] as $key => $value)
    {
 
if($form_state['values']['category_boundary']['category_fieldset']['catg
'][$index] > 0)
        {
               //row is selected.
        }
        else
       {
                 //row is not selected.
        }
    }

 

I can determine all the rows if those are selected or not except the 0th
row.

Can somebody tell me, what is the RIGHT way to determine if a particular
row in a table is selected or not.

 

Best Regards

Kamal

 

 

 

 

 

 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20120913/0b272e83/attachment.html 


More information about the support mailing list