Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By ken nguyen on
Hi All,
I have an tableselect and submit button. When I click to the submit button - ajax will call to the function and I want to get the value of rows which are selected in the table select. How can I do it?
I also try $value = $form_state[value][table] but it returned for me an array, not an ID value of row. In this case I also checked 1 row.
Thanks
Comments
Non-selected rows will have a
Non-selected rows will have a value of zero. Selected rows will have the value of the selected checkbox/radio.
For example, if your options are:
And you selected Sunday and nine, $form_state['values']['table'] would be:
Hi jaypan,
Hi jaypan,
I have
$tests = $form_state['values']['table'];
foreach(tests As test) {
$options = array (
test -> value , ??? Is it right
);
}
As your example, I want to print 'Sunday' so how can i do it?
Thanks for your help too much
You cannot print in submit
You cannot print in submit functions.
I'm not entirely clear on what you want to achieve.
my response
Hi Jaypan,
Sorry for make you confuse.
Actually I have a select list and a tableselect.
The first I will check a row on table which will be updated value.
Then I will select an option of select list and the ajax will be called back.
The value of the row of table which is checked before will be updated by the value of an option of select list
So where are you trying to
So where are you trying to get the value of the table select? In a submit function?
Yes
Yes. Do you have any ideas?
<?phpif($form_state['values']