Hi.

I have created a form which takes a list of hostnames and shows the 
hostnames with checkboxes next to it. The idea is to be able to uncheck any 
hostnames and pass the still checked hostnames to another function which 
will then act on that list of hostnames. The problem is that it just 
returns an empty list.

I am new to web2py, this is my first project, so if my thinking is wrong, 
I'm ok with rewriting this part from scratch.

Here is the code:

def verify():
    hostnames=request.vars.hostnames.split()
    num_hosts=len(hostnames)
    form=FORM(TABLE(TR("Hostnames")))
    for hn in hostnames:
        row=XML('<input type="checkbox" name="{{=hn}}" value="{{=hn}}" 
checked>'+ hn)
        form[0].append(row)
    form[0].append(XML('<div id="submit"><button>Submit!</button></div>'))
                   
    if form.accepts(request,session):
        redirect(URL('execute',vars=dict(hostnames=form.vars.hostnames)))
    return dict(hostnames=hostnames,form=form)

Thanks in advance for your help.

Jim

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to