[web2py] Re: SQLFORM not handling hidden fields? Or do I have a bug?

2011-09-15 Thread Cliff
All is good. I just wanted to make sure I was seeing the intended behavior. On Sep 15, 9:30 am, Massimo Di Pierro wrote: > After reading this again and again... this is the intended behavior. > > form = SQLFORM(,hidden=...) causes the hidden fields to be passed > with the submission, no more

[web2py] Re: SQLFORM not handling hidden fields? Or do I have a bug?

2011-09-15 Thread Massimo Di Pierro
After reading this again and again... this is the intended behavior. form = SQLFORM(,hidden=...) causes the hidden fields to be passed with the submission, no more, no less. form.accepts(...) is not intended to read the received hidden fields and move them into form.vars. The reason is securit

[web2py] Re: SQLFORM not handling hidden fields? Or do I have a bug?

2011-08-30 Thread Cliff
Hmmm. I'm on 1.98.2. This needs more investigation, but I can't do it today. On Aug 30, 8:39 am, DenesL wrote: > SQLFORM with hidden fields works fine in 1.98.2: > > # model > db.define_table('dog', >   Field('name'), >   Field('age', 'integer') >   ) > > # controller > def newdog(): >   form =

[web2py] Re: SQLFORM not handling hidden fields? Or do I have a bug?

2011-08-30 Thread DenesL
SQLFORM with hidden fields works fine in 1.98.2: # model db.define_table('dog', Field('name'), Field('age', 'integer') ) # controller def newdog(): form = SQLFORM(db.dog, fields=['name'], hidden={'age': 1}) if form.accepts(request, session): response.flash = 'ok' elif form.errors:

[web2py] Re: SQLFORM not handling hidden fields? Or do I have a bug?

2011-08-30 Thread Cliff
The rest of the insert is working. As a workaround I'm doing a table update right after the form.accepts() and just before the redirect. On Aug 29, 3:45 pm, Anthony wrote: > Does it insert the non-hidden fields, or is no record getting inserted at > all? > > > > > > > > On Friday, August 26, 201

[web2py] Re: SQLFORM not handling hidden fields? Or do I have a bug?

2011-08-29 Thread Anthony
Does it insert the non-hidden fields, or is no record getting inserted at all? On Friday, August 26, 2011 5:43:15 AM UTC-4, Cliff wrote: > > I use SQLFORM something like this: > > fields = 'dog_name dog_weight dog_birtdate'.split(' ') > hidden = {'dog_owner' : some_known_value} # We already kno

[web2py] Re: SQLFORM not handling hidden fields? Or do I have a bug?

2011-08-29 Thread DenesL
On Aug 29, 1:22 pm, Cliff wrote: > It would look something like this: > > db.define_table('dogs', >     Field('dog_name'), >     Field('dog_birthdate', 'date'), >     Field('dog_weight', 'integer'), >     Field('dog_owner', db.owner) > ) > db.dogs.dog_owner.requires=IS_IN_DB(db, db.dogs.id, >  

[web2py] Re: SQLFORM not handling hidden fields? Or do I have a bug?

2011-08-29 Thread Cliff
It would look something like this: db.define_table('dogs', Field('dog_name'), Field('dog_birthdate', 'date'), Field('dog_weight', 'integer'), Field('dog_owner', db.owner) ) db.dogs.dog_owner.requires=IS_IN_DB(db, db.dogs.id, '%(owner_name)s', zero="Choose an owner") Caveat: no

[web2py] Re: SQLFORM not handling hidden fields? Or do I have a bug?

2011-08-29 Thread Cliff
Anthony, Good catch. The form should be SQLFORM, the table should be db.purchase_orders. On Aug 29, 10:18 am, Anthony wrote: > Did you show the correct controller code? Your form is define as a SQLTABLE > (rather than SQLFORM), and the table argument is db.suppliers, not > db.purchase_orders.

[web2py] Re: SQLFORM not handling hidden fields? Or do I have a bug?

2011-08-29 Thread Anthony
Did you show the correct controller code? Your form is define as a SQLTABLE (rather than SQLFORM), and the table argument is db.suppliers, not db.purchase_orders. Anthony On Monday, August 29, 2011 7:33:25 AM UTC-4, Cliff wrote: > > Not sue that would help. > > The insert goes into purchase_or

[web2py] Re: SQLFORM not handling hidden fields? Or do I have a bug?

2011-08-29 Thread DenesL
Cliff, please post the related "dogs" table model.

[web2py] Re: SQLFORM not handling hidden fields? Or do I have a bug?

2011-08-29 Thread Cliff
Not sue that would help. The insert goes into purchase_orders, not supplier_contacts. On Aug 26, 4:16 pm, Anthony wrote: > Does it work if you set db.supplier_contacts.supplier_id.writable = True in > the controller function? > > > > > > > > On Friday, August 26, 2011 11:12:31 AM UTC-4, Cliff wr

[web2py] Re: SQLFORM not handling hidden fields? Or do I have a bug?

2011-08-26 Thread Anthony
Does it work if you set db.supplier_contacts.supplier_id.writable = True in the controller function? On Friday, August 26, 2011 11:12:31 AM UTC-4, Cliff wrote: > > Massimo, > > Thank you. > > Of course. > > Here are are the real table defs: > ++

[web2py] Re: SQLFORM not handling hidden fields? Or do I have a bug?

2011-08-26 Thread Cliff
Massimo, Thank you. Of course. Here are are the real table defs: +++ ++ db.define_table('purchase_orders', Field('issue_date', 'date'), Field('number', length=24, requires=IS_NOT_EMPTY(), required=True,

[web2py] Re: SQLFORM not handling hidden fields? Or do I have a bug?

2011-08-26 Thread Massimo Di Pierro
Can I see the model? On Aug 26, 4:43 am, Cliff wrote: > I use SQLFORM something like this: > > fields = 'dog_name dog_weight dog_birtdate'.split(' ') > hidden = {'dog_owner' : some_known_value} # We already know who the > owner is > SQLFORM(db.dogs, fields=fields, hidden=hidden) > > The hidden fi