Alright, I figured out what I was doing.  I didn't realize that
checkboxes don't send anything if they are unchecked so I was calling
an ajax() function in javascript to submit a form and always including
the checkbox value regardless of if it was checked.  Even if it was
unchecked it still submitted the value.  I had to put in some
javascript to check if the checkbox was checked or not and then build
the ajax() function accordingly.  Sorry to waste your time with this.
I am pretty new to all of this so sometimes I end up barking up the
wrong tree.  Thanks for you help.

-Jason

On Feb 22, 8:11 pm, mdipierro <[email protected]> wrote:
> def check():
>    default=True
>    form=FORM(INPUT(_type='checkbox',_name='check',value=default),INPUT
> (_type='submit'))
>    if form.accepts(request.vars):
>        if form.vars.check: response.flash='checked'
>        else: response.flash='not checked'
>    return dict(form=form)
>
> On Feb 22, 9:58 pm, jlegler <[email protected]> wrote:
>
> > If I have a custom form, I seem to always have the checkbox returning
> > the same result whether it is checked or not.  Does anyone have any
> > examples on how to make the checkbox return different results
> > depending on whether it is checked or not?  All I want to do is have
> > the checkbox represent whether something is true or false in the
> > database and if it is modified, have it modify the database.  It works
> > exactly the way I want it to when I go into the database
> > administration portion of the GUI so seeing the source for that would
> > even be helpful although I can't seem to find that either.  Does
> > anyone have any examples of a best practice way to accomplish this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to