Hello;

I am using SELECT in a FORM and I noticed this behavior.

Using the following in a controller, such as default.py:

def selector_test():
    items = [
        OPTION('One', _value=1),
        OPTION('Two', _value=2),
        OPTION('Three', _value=3),
    ]

    form = FORM(
            SELECT(_name='first', *items, value=request.vars['first'] or 
None),
            SELECT(_name='second', *items, value=request.vars['second'] or 
None),
            SELECT(_name='third', *items, value=request.vars['third'] or 
None),
            INPUT(_type='submit')
    )
    if form.accepts(request, session):
        response.flash = 'form processed'
    elif form.errors:
        response.flash = 'error!'
    else:
        response.flash = 'enter form'

    return dict(form=form, vars=form.vars)


When I go to that page, I see the following selectors:
  [ One ]  [ One ]  [ One ]

When I set the value to so:
  [ One ]  [ Two ]  [ Three ]

And click submit, I observe the following:

The vars in the request is:
vars:first:1second:2third:3
But, the SELECT display:
  [ Three ]  [ Three ]  [ Three ]


I observe the same behavior is I use value or _value, on Chrome 26 and 
Firefox 19 / Mac OSX.
What can I do to have the SELECT display the value from the form.vars?

Thank you for your time;

-Rob Powell

-- 

--- 
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/groups/opt_out.


Reply via email to