[web2py] Re: Confused about hidden fields

2011-11-03 Thread Omi Chiba
Thanks David !! On Nov 3, 10:31 am, TheSweetlink wrote: > I am not certain that the case is the same but one thing I noticed > with SQLFORM.factory and hidden fields was that in order to pass a > hidden field from the SQLFORM.factory(...hidden=dict(Sir Robin: 'the > brave')) required that a Field

[web2py] Re: Confused about hidden fields

2011-11-03 Thread TheSweetlink
I am not certain that the case is the same but one thing I noticed with SQLFORM.factory and hidden fields was that in order to pass a hidden field from the SQLFORM.factory(...hidden=dict(Sir Robin: 'the brave')) required that a Field(...) be defined for it in the form definition. To make it hidden

[web2py] Re: Confused about hidden fields

2011-11-03 Thread DenesL
On second thought it is not broken. request.vars are processed during form.accepts and form.vars will contain validated values afterwards. Since in this case field2 is not in request.vars, form.vars.field2 will be set to None. To set the value of field2, without it coming in thru request.vars (i.

[web2py] Re: Confused about hidden fields

2011-11-02 Thread Omi Chiba
Thanks everyone. I'm easy person so I use the CSS to hide it just like JmixIII mentioned. something like this. View jQuery(function(){ jQuery('.hidden').hide(); }; {{extend 'layout.html'}} {{=form.custom.begin}} Field1: {{=form.custom.w

Re: [web2py] Re: Confused about hidden fields

2011-11-02 Thread JmiXIII
Hello, For hidden field I usually used

Re: [web2py] Re: Confused about hidden fields

2011-11-02 Thread Philip Kilner
Hi, On 02/11/2011 13:59, DenesL wrote: form.vars.field2 = 'BBB' This should work to pre-populate the value of field2 with 'BBB' but it seems to be broken in 1.99.2 I'm so glad you said that - this was one of the things I tried in troubleshooting my "Passing values to CRUD create from

[web2py] Re: Confused about hidden fields

2011-11-02 Thread DenesL
On Nov 1, 11:11 pm, Omi Chiba wrote: > Thank you for understanding me :) > I tried but this code will set the default value if the field exist on > the view. > > I made a simple example. I don't want to show field2 so it's excluded > in view using custom form but want to store the value like 'BB

[web2py] Re: Confused about hidden fields

2011-11-02 Thread apple
Instead of form.accepts() you can use form.validate() and then do your own update. Then you do not need to pass unnecessary variables to the view and back again. form = SQLFORM(table, id) if form.validate(): form.vars.mysecretvariable="whatever I want" if not form.errors:

[web2py] Re: Confused about hidden fields

2011-11-01 Thread Omi Chiba
Thank you for understanding me :) I tried but this code will set the default value if the field exist on the view. I made a simple example. I don't want to show field2 so it's excluded in view using custom form but want to store the value like 'BBB' or 'CCC' before it's inserted into table. This

[web2py] Re: Confused about hidden fields

2011-11-01 Thread pbreit
I believe in your controller, before form.process() (or form.accepts), include: form.vars.FFTSCD = 'aaa'