Hi,

The follows is a simplification.

If my controller is:

def buscar():
    form = FORM(TABLE(
            TR(INPUT(_name='mytxt', _id='mytxt', _value='a text...')),
            TR(INPUT(_type='checkbox', _name='mychk', _id='mychk',
_value='')),
            TR("", INPUT(_type="submit",_value="Buscar"))
            ))

    if form.accepts(request.vars, session, keepvalues=True):
        if request.vars.mychk:
            ...
            ...
        rows = db(query1 & query2).select()

    return dict(form=form, rows=rows)


When I send the form, I know the state of the checkbox on the line [if
request.vars.mychk]. This works well!


In the example below I can not get the same result, The condition is
always true. This is because I is returning the value, which is always
'on', even though I put something else.

def search2():
    form = FORM(TABLE(
            TR(INPUT(_name='mytxt', _id='mytxt', _value='a text...')),
            TR(INPUT(_type='checkbox', _name='mychk', _id='mychk',
_value='')),
            TR("", INPUT(_type="button", _value="Buscar",
                    _onclick="ajax('bg_find2',['mytxt', 'mychk'],
'target');"))
            ))

    return dict(form=form, target=DIV(_id='target'))

def bg_find2():
     if request.vars.mychk:
        ...

    return dict(txt=request.vars.mytxt, chk=request.vars.mychk)


How can I access the checkbox checked property?
Or more simply, how can I know the state of the checkbox in bg_find2

Regards
Jose
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" 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