You need to rewrite request.vars into form.vars in form validation.
I use following (based on maybe web2py doc or maybe some article in this 
conference).
I have javascript YUI2 autocomplete in client (on customer field), which 
will set hidden customer_id field.
In JavaScript I use jQuery selector for the hidden 
field: '[name="customer_id"]'

def get_customer():
    # 
https://groups.google.com/forum/?fromgroups#!searchin/web2py/hidden$20field/web2py/XZEWSfgHHik/tMPqtl5pRlEJ
    #   seems it can be solved easier
    form = SQLFORM.factory(
        Field('customer', label="Select customer"),
        Field('customer_id', readable=False, writable=False),
        hidden=dict(customer_id='')
        )
    if form.process(onvalidation=_validate_form).accepted:
        db.order[request.args(0)] = dict(customer_id=form.vars.customer_id)
        redirect(........)
    return dict(form=form, selectable_customers=.....)

def _validate_form(form):
    if request.vars.customer_id:
        form.vars.customer_id = request.vars.customer_id
    else:
        form.errors.customer = "Enter text to find customer"







Dne úterý, 9. září 2014 12:50:48 UTC+2 trr napsal(a):
>
>
> I have a hidden input in form. I set the hidden value in client by java 
> script. But I am not able to get the value in request.vars or 
> request.post_vars in controller. It returns None. How to get the hidden 
> input values in controller.? I generate the form in controller and is post 
> method.
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to