[web2py] Re: keepvalues per field?

2010-07-30 Thread mdipierro
a, has, current, please=db.define_table, Field, request.vars, crud

the_thing=a('thing', has('name'), has('category'))

my_things = db(thing.id>0)

def index():
 the_thing.category.default = current.category
 form = please.create(the_thing)
 things = my_things.select()
 return dict(form = form, things = things)

On Jul 30, 7:47 am, Johann Spies  wrote:
> On 26 July 2010 13:44, mdipierro  wrote:
>
> > You can use
>
> > db.table.field.default=previous_form.vars.field
>
> > to propagate the values forward..
>
> Where do I do this?   I suppose the controller is the correct place,
> but do I do it in the same environment where I would use keepvalues?
> I don't want the values to be written directly to the database.   The
> "db.table.field.default" is confusing me a little bit.
>
> Also:  where can I read a little bit about "previous_form"?  I did not
> find anything in the book.  Maybe it is something for the new book.
>
> Regards
> Johann
>
> --
>     "Be not deceived; God is not mocked: for whatsoever a
>      man soweth, that shall he also reap."
>                                   Galatians 6:7


Re: [web2py] Re: keepvalues per field?

2010-07-30 Thread Johann Spies
On 26 July 2010 13:44, mdipierro  wrote:
> You can use
>
> db.table.field.default=previous_form.vars.field
>
> to propagate the values forward..

Where do I do this?   I suppose the controller is the correct place,
but do I do it in the same environment where I would use keepvalues?
I don't want the values to be written directly to the database.   The
"db.table.field.default" is confusing me a little bit.

Also:  where can I read a little bit about "previous_form"?  I did not
find anything in the book.  Maybe it is something for the new book.

Regards
Johann


-- 
    "Be not deceived; God is not mocked: for whatsoever a
     man soweth, that shall he also reap."
                                  Galatians 6:7


Re: [web2py] Re: keepvalues per field?

2010-07-26 Thread Johann Spies
Fantastic.  Thanks.

Johann

-- 
    "Be not deceived; God is not mocked: for whatsoever a
     man soweth, that shall he also reap."
                                  Galatians 6:7


[web2py] Re: keepvalues per field?

2010-07-26 Thread mdipierro
You can use

db.table.field.default=previous_form.vars.field

to propagate the values forward..

On Jul 26, 6:41 am, Johann Spies  wrote:
> Is there a way to do the "keepvalues"  thing per field?  I have forms
> which have up to 40 fields. Datacapturers will have to enter of forms
> of which the first 5-7 fields will be identical for the batch.
>
> Regards
> Johann
>
> --
>     "Be not deceived; God is not mocked: for whatsoever a
>      man soweth, that shall he also reap."
>                                   Galatians 6:7