[web2py] form fields

2018-05-30 Thread Andrea Fae'
Hello I have a SQLFORM but some of them I populate from other variables and 
I don't want to change. So I typed field.writable=False...
But when I use a custom "onvalidation" function I want to have the content 
of all the form fields...
In request.vars I see some fields but not all
In form.vars I see part of these fields
Both without the not writable fields.

How is working? request.vars, form.vars. Why do they show different field 
values? Why I can't see the not wirtable values? I tried to read the book, 
but I didn't find the information yet.
Thanks a lot

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


[web2py] Form fields in DB showing a 0 value

2013-11-09 Thread raferbop


db.define_table(
'route',
Field('city'),
Field('country_iso'))


db.define_table(
'order_bus',
Field('depart_from', db.route),
Field('arrive_to', db.route),
Field('date', 'date'),
Field('time', db.depature_times), # drop-down select time options
Field('no_of_passengers', db.tickets), # drop-down options to select 
number of positions
Field('posted_on', 'datetime', readable=False, writable=False),
Field('posted_by', readable=False, writable=False))

db.order_bus.time.requires = IS_IN_DB(db, 'depature_times.id', '%(time)s', 
zero=T('Select Time')) 

db.order_bus.depart_from.widget = SQLFORM.widgets.autocomplete(request, 
db.route.city, limitby=(0,10), min_length=2)

db.order_bus.arrive_to.widget = SQLFORM.widgets.autocomplete(request, 
db.route.city, limitby=(0,10), min_length=2)

db.order_bus.depart_from.requires = IS_IN_DB(db, 'route.city', zero='')

db.order_bus.arrive_to.requires = IS_IN_DB(db, 'route.city', zero='')

db.order_bus.no_of_passengers.requires = IS_IN_DB(db, 'tickets.id', 
'%(people)s', zero=T('Passengers'))


The route DB looks like this;

route.id   route.city  route.iso
1Washington DC US
2New York City   US
3Miami   US
4Atlanta  US




Good day guys,

The above model is based on a form that I created. Everything works just 
fine, except that when I submit the form, the depart_from and arrive_to 
fields have a 0 value. How can I get those fields to display either the 
route.id or route.city?

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