Getting A Value From A Dynamic Table

Hi guys! I am new here and I’m hoping to become a good part of this community. Now, let’s get to my problem. I have a table that is created dynamically using Datatables.


foreach ($results as $value)

    	{

    		echo '

    			<tr>

    				<td>'.$value->object_name.'</td>

    				<td>'.$value->issn.'</td>

    				<td>'.$value->object_publisher_name.'</td>

    				<td>'.$value->remarks.'</td>

    				<td id="chkbutton">'.$form->checkBox($model,"journal_id").'</td>

    				<td style="display:none;">'.$value->object_id.'</td>

    			</tr>';

    	}

I have to get the value (journal_id) from the hidden column when the corresponding check box is checked and then call the DB to get the data with the corresponding ID and fill a drop down list. How am I supposed to do that?

Hi and welcome to Yii!

try this:


echo CHtml::activeId($model,"journal_id");

Thank you for your answer, but how am I supposed to use this?

Aren’t you supposed to get the value in the checkbox and not the hidden field with unchecked value generated? You should be able to use javascript/jquery to grab the checkbox value. Add a click event, make sure its been checked then get the value