I have the following function:

def app_settings():
    vertexID = session.vertexID
    
    record = table(vertexID=vertexID)
   
    form = SQLFORM(table, record, showid=False)

    if form.validate():
        if form.deleted:
           ...
        else:
            viewtypeID = int(form.vars.viewtypeID)

            if record and (int(record.viewtypeID) != viewtypeID):
                ...

            get_flash(session, None, 'success', 'success')
            redirect(URL('app_manage', args=vertexID))

    elif form.errors:
        get_flash(response, None, 'danger', 'error')
    elif not response.flash:
        get_flash(response, None, 'info', 'default')

    return dict(form=form)


The problem is that if record.viewtypeID is for example 2 and in the form I 
change
it to for example 5 the test: (int(record.viewtypeID) != viewtypeID) fails.
Both record.viewtypeID and  form.vars.viewtypeID have value 2

When I change form.validate() to form.process().accepted
the test: (int(record.viewtypeID) != viewtypeID) evaluates to True because 
form.vars.viewtypeID now has the value 5

I wonder why in the first case form.vars.viewtypeID is 2 instead of 5


Kind regards,

Annet

-- 
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