Guy's thanks for your help yesterday.
Massimo, I am developing for app engine so the "&" selects do not work
and I had to modify '=' to '==' in a couple of places to get the view
to load without GAE errors.
It is still not quite working, I nested 'if's' for GAE selects perhaps
you will see what needs amending?
thanks chrism

in contoller I have:

def check():
    part_id=request.args(1)
    prodj_parts_list=db(db.prodj_refs.prodj_id==request.args(0)).select
()
    for p in prodj_parts_list:
        if not db(db.prodj_parts.id==p.part_id).delete():
          return 'jQuery('#selector%i' % part_id).html('not selected')
    else:
        db.prodj_refs.insert(prodj_id=request.args(0),part_id=part_id)
    return 'jQuery('#selector%i' % part_id).html('selected')



and in view:
<table width="100%" cellpadding="1" cellspacing="0" border="0"
class="display" id="example">
                        <thead>
                        <tr>
                        <th>Part 
Name</th><th>Content</th><th>Number</th><th>Created On</
th>
                        </tr>
                        </thead>
                        <tfoot>
                        <tr>
                        <th>Part 
Name</th><th>Content</th><th>Number</th><th>Created On</
th>
                        </tr>
                        </tfoot>
                        <tbody>
                        {{for part in parts:}}
                        <tr>
                        <td>{{=part.part_name}}</td>
                        <td>{{=part.part_content}}</td>
                        <td>{{=part.part_number}}</td>
                        <td>{{=part.timestamp.year}}</td>
                        <td><input type="checkbox" id="selector{{=part.id}}"
                          onclick="{{=URL(r=request,f='check',args=
[prodj.id,part.id])}}">
                        {{if db((db.prodj_refs.prodj_id==request.args
(0))&(db.prodj_refs.part_id==part.id)).count():}}selected{{else:}}not
selected{{pass}}
                        </input> </td>
                        </tr>
                        {{pass}}
                        </tbody>
                        </table>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to