1) you changed the check() action from my example. I do not understand what it does anymore. I thought it would remove or add a single part but now it has a loop. why? 2) did you try calling the check/[prod_id]/[part_id] action without ajax? That will give you a ticket that helps debugging. 3) You my div with a input checkbox. Input does not have a </input>. 4) The code
{{if db((db.prodj_refs.prodj_id==request.args (0))&(db.prodj_refs.part_id==part.id)).count():}}selected{{else:}}not selected{{pass}} does not belong there anymore (becase input has no content). I guess you want <input type="checkbox" id="selector{{=part.id}}" onchange="{{=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():}} checked="checked"{{else:}}not selected{{pass}} /> 7) When you change 6) you wil also need to change the jquery commands returned by the check() action. On Aug 25, 7:17 am, murray3 <ch...@murraypost.net> wrote: > 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 -~----------~----~----~----~------~----~------~--~---