Nice one
On Thursday, April 30, 2020 at 9:14:48 PM UTC+2, Scott Hunter wrote:
>
> Would this do the job?
>
> form = SQLFORM.factory(*fields)
> if form.process().accepted:
> # update the database here
> form2 = SQLFORM.factory(*fields)
> form2.vars['state'] =
Wow, that is clever! And, works just how I want it to. Thanks so much for
the pointer.
-Jim
On Thursday, April 30, 2020 at 2:14:48 PM UTC-5, Scott Hunter wrote:
>
> Would this do the job?
>
> form = SQLFORM.factory(*fields)
> if form.process().accepted:
> # update the
Would this do the job?
form = SQLFORM.factory(*fields)
if form.process().accepted:
# update the database here
form2 = SQLFORM.factory(*fields)
form2.vars['state'] = form.vars.state
form2.process()
else:
form2 = form
return
Here is what I'm talking about:
def update_something():
fields = [Field('name'),
Field('address', 'text'),
Field('city'),
Field('state'),
Field('zip_code')]
form = SQLFORM.factory(*fields)
if form.process().accepted:
#
Isn't "the next time through the method" when there is a new submission,
which would have the saved value in it (unless the user changed it)? Maybe
a sample of your code would make things clearer.
On Thursday, April 30, 2020 at 1:21:53 PM UTC-4, Jim S wrote:
>
> Yes, but I need that value on
Yes, but I need that value on the next time through the method. Therefore
I have to save it to my session and grab it the next time in. Am I missing
something?
On Thu, Apr 30, 2020 at 12:19 PM Scott Hunter wrote:
> Since the value in question is part of the current submission, isn't the
>
Since the value in question is part of the current submission, isn't the
value available in form.vars?
- Scott
On Thursday, April 30, 2020 at 12:54:02 PM UTC-4, Jim S wrote:
>
> I was hoping to avoid those tricks. I too have done this by storing
> values in the session to be redisplayed. I
I was hoping to avoid those tricks. I too have done this by storing values
in the session to be redisplayed. I was hoping that the keepopts argument
to SQLFORM would allow you to specify which fields to keep, but it seems
that is used for something else.
On Thu, Apr 30, 2020 at 11:48 AM Scott
I recall doing this by "pre-populating" the field you want to keep with the
old value.
- Scott
On Thursday, April 30, 2020 at 11:10:42 AM UTC-4, Jim S wrote:
>
> Does anyone know how I can have a form 'keepvalues' but only keep one
> specific field value? I don't want it to keep the values
9 matches
Mail list logo