Order of form.vars not same as they appear in form

29 views
Skip to first unread message

Rahul Priyadarsi

unread,
Jan 12, 2017, 1:37:03 PM1/12/17
to web2py-users
Currently I see that the order in which the fields appear in form is not same when i iterate through form.vars
I am using SQLFORM.

So how do I get the form.vars so that they appear in same order as they do on the form?

Anthony

unread,
Jan 12, 2017, 2:42:26 PM1/12/17
to web2py-users
form.vars is a dict-like object, so not guaranteed to return keys in any particular order. If the form is based on a db table, you can iterate through db.table._fields. The form object also includes the list of field names in form.fields.

Anthony

Rahul Priyadarsi

unread,
Jan 13, 2017, 1:24:46 PM1/13/17
to web...@googlegroups.com
Yes form.fields works!
Thank you very much

--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/fZygOaWseek/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Cheers,
RAHUL PRIYADARSI

Reply all
Reply to author
Forward
0 new messages