Hi,

I am creating a web app for attending employees.

This is the model:

db.define_table(
    'employee',
     Field('name'),
     format = '%(name)s')
db.define_table(
    'attendance',
    Field('employee_id',db.employee),
    Field('attend','boolean'),
    Field('comments','text') )

This is the controller:
def fillForm():
    employeeIDS=db(db.employee).select(db.employee.ALL)
    form = SQLFORM(db.attendance)
    if form.process(session=None, formname='test').accepted:
        response.flash = 'form accepted'
    elif form.errors:
        response.flash = 'form has errors'
    else:
        response.flash = 'please fill the form'
    return locals()

This is the view:
<form action="#" enctype="multipart/form-data" method="post">
<table>
<thead>
    <th>name</th>
    <th>attend?</th>
    <th>comments</th>
</thead>
<tbody>
    {{for eid in employeeIDS:}}
<tr>    
<td>    {{=eid.name}}</td>
<!--<td>   <input  name="employee_id"/></td> -->
<td>   <input  name="attend" id={{=eid.id}} type="checkbox"/></td> 
<td>   <input  name="comments" id={{=eid.id}} type="text" value=""/></td> 
</tr>    
{{pass}}
    <input type="hidden" name="_formname" value="test" />
    <input type="submit" />
</tbody>
</table>
</form>

The question is:

How can I insert the data in each row in the table to be in one row in the 
attendance table, whether the employee is attendance or absence ?


Best Regards,

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to