Tabular Input

Dear friends,

I’m using YII 1. I have 2 tables:

student(id, name)

classcheck(id, student_id, date)

Now please help me to create a form in classcheck (views/classcheck/_form.php) that lists all the students as a checklist and a date field so that I can check students who joined class on that date. I know that we need to use tabular input but I can’t understand how to use it and apply to my case here. I’d appreciate if you can help me friends.


echo CHtml::checkBoxList( 'students', '', CHtml::listData( Students::model()->findAll, 'id', 'name' ) );


Dear SiZE,

Thank you for your response. The code above is to show the checklist only. We can only save 1 record while I want to save many records. How to save many records for my case?

Dear all,

Could you please help me? This is really important to me. Just one click button(Create) I need to save multi records like this

checkclass table(id, student_id, date)




maybe this will help. link


Dear all,

This is my demo You should log in with demo/demo and click Class, then create a new classcheck to see what I mean. I’ve loaded student_id from student table as a checklist. Now how can I save many records like I said as I click the Create button?

Dear all,

This is my trick. In _form.php add an array of student_id

<?php $studentid[10] = CHtml::listData( Student::model()->findAll(), ‘id’, ‘name’ ); ?>

Then in controller edit the actionCreate adding the insert command

Dear all,

In controller I think we’d better not use Insert command. Please suggest another solution such as tabular input. The UniqueAttributesValidator extension doesn’t work for my case.