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, just set readable=False, writable=False. So what I
did was something like this:
SQLFORM.factory(Field(...), Field(...), Field('sirRobin',
readable=False, writable=False...),
hidden=dict(sirRobin: 'the brave')
This will create a hidden field that isn't shown or which you can
change and its value is passed in from the controller.
You're already using a custom form and that's important too as the
hidden field must be somewhere in your custom form so that it can
submit your hidden field along with the rest of the form.
I hope this is helpful to you Omi.
David
On Nov 1, 6:20 pm, Omi Chiba <[email protected]> wrote:
> Sorry, I'm so confused and hard to explain but...
>
> I have a field which value was set from another table and don't want
> to show on the user. I just want to set default value in controller
> and submit the form with the fields user filled in.
>
> Do I need to include the field in the view but make it hidden ?
>
> or
>
> Use SQLFORM(...., hidden=dict(FFTSCD='aaa'),
>
> below is a part of my view FFTSCD is the field I don't want to show.
> --------------------------------------
> {{extend 'layout.html'}}
> <h1>Fedex Request Form - {{=keyHJ}}</h1>
> Report Date: {{=form.custom.widget.FFTRD}}
> {{=form.custom.begin}}
> <table>
> <tr><td colspan="2"><h3>User Information</h3></td><tr>
> <tr><td>Created by: </td><td>{{=form.custom.widget.FFCUSR}}</td></tr>
> <tr><td>Created on: </td><td>{{=form.custom.widget.FFCDAT}}</td></tr>
>
> <tr><td>{{=form.custom.submit}}</td></tr>
> </table>
> {{=form.custom.widget.FFTSCD}}
> {{=form.custom.end}}