Perfect!

Thanks so much!

One thing I've been thinking about, is putting together a reference
database that
will help newbies learn from working examples.

As I browse the forum, I see people asking things such as
"How do I populate a drop-down list from a table.

Providing a reference database would help give people actual
working examples of code that can be viewed and customized to fit
specific needs.

What does everyone think?

Again thanks for the GREAT example Mr. Freeze


On Jun 6, 7:10 pm, "mr.freeze" <nat...@freezable.com> wrote:
> Something like this?
>
> def delete_things():
>     table = TABLE()
>     recs = db(db.things.id > 0).select()
>     for rec in recs:
>         chk = INPUT(_type='checkbox',
>                     _name='st_%s' % rec.id)
>         table.append(TR(rec.id,rec.name,chk))
>     form = FORM(table,INPUT(_type='submit'))
>     if form.accepts(request.vars,session):
>         for k,v in request.vars.items():
>             if k.startswith('st_'):
>                 id = k.split('_')[-1]
>                 db(db.things.id == int(id)).delete()
>     return dict(form=form)
>
> On Jun 6, 6:39 pm, NetAdmin <mr.netad...@gmail.com> wrote:
>
> > I have a table with the following structure.
> >     firstname string
> >     st            boolean
>
> > I can display the info with a view,
> > but I'd like to check/uncheck certain names
> > using the status check box, then delete
> > the checked names.
>
> > I feel I'm going about this the WRONG way
> > because most of the logic should be in
> > a controller, and views should mostly
> > only display the data.
>
> > Here's the view.
>
> > Thanks in advance!
>
> > <table>
> > {{ for r in recs : }}
> > <tr>
> > {{=TD(r.id)}} {{=TD(r.firstname)}}
> > <td><form> <input type = 'checkbox' name = 'st' {{ if r.st == True: }}
> > checked {{pass}} > </form> </td>
> > </tr>
> > {{pass}}
> > <table>

Reply via email to