Hi Richard,

Here is what I have so far:

Controllers:
def user_list():
     grid=SQLFORM.smartgrid(db.users, paginate=20, links_placement='left', 
_href=URL('transition_form', vars=dict((f, row[f]) for f in 
db.users.fields))))], user_signature=True)
     return dict(grid=grid)

def transition_form():
     for f, v in request.vars:
     db.table[f].default = v
 form = SQLFORM(db.table, user_signature=True)
return dict(form=form)

View:
user_list.html
{{=form}}

This properly populates the values. but it isn't submitting properly. After 
the form submits I would like it to return to the database and show me the 
user that was just added. Also, I set my database to autoincrement the ID 
which should solve the "id problem"

I was thinking I could set something in my transition_form function that if 
form.process().accepted: redirect(URL('user_list')), but I get an error 
saying table object has no attribute '_formkey' does this mean I need to do 
some type of form validation?

On Monday, May 5, 2014 9:53:38 AM UTC-4, Richard wrote:
>
> Please show code!!
>
> Richard
>
>
> On Mon, May 5, 2014 at 8:50 AM, LoveWeb2py <[email protected]<javascript:>
> > wrote:
>
>> Also, 
>>
>> When I click the submit button in {{=form}} it doesn't actually submit 
>> anything. It just doubles the values that are already in the fields and 
>> puts them into a list. I think I need to do something like db.insert with a 
>> new ID number for the submit button.
>>
>>
>> On Monday, May 5, 2014 8:46:25 AM UTC-4, LoveWeb2py wrote:
>>>
>>> Richard/Niphold,
>>>
>>> Thank you so much. It's almost done. Just getting attribute error now 
>>> but I am going to try to fix that with exception handling. 
>>>
>>> <type 'exceptions.AttributeError'> 'str' object has no attribute 'year'
>>>
>>> I have a modified_on field which is set to datetime. WHen I comment that 
>>> out it transfers to the next page with no problem. Any thoughts on how I 
>>> could fix?
>>>
>>> On Sunday, May 4, 2014 9:10:55 AM UTC-4, Richard wrote:
>>>>
>>>> Sorry for miss leading, Niphold is true...
>>>>
>>>> So, 
>>>>
>>>> for f, v in request.vars.iteritmes():
>>>>      db.table[f].default = v
>>>>
>>>>
>>>> On Sat, May 3, 2014 at 8:47 AM, Niphlod <[email protected]> wrote:
>>>>
>>>>> request.vars is like a dict. Surely you're hitting that issue :-P
>>>>>
>>>>> >>> test = dict(a=1,b=2)
>>>>> >>> for k,v in test:
>>>>> ...    print k, v
>>>>> ... 
>>>>> Traceback (most recent call last):
>>>>>   File "<stdin>", line 1, in <module>
>>>>> ValueError: need more than 1 value to unpack
>>>>> >>> 
>>>>>
>>>>> Add an "iteritems()" and you're good to go
>>>>>
>>>>> >>> for k,v in test.iteritems():
>>>>> ...     print k,v 
>>>>> ... 
>>>>> a 1
>>>>> b 2
>>>>>
>>>>> >>> 
>>>>>
>>>>> On Friday, May 2, 2014 11:20:40 PM UTC+2, LoveWeb2py wrote:
>>>>>>
>>>>>> Web2py admin console has a red line at for f, v in request.vars: and 
>>>>>> then says too many values to unpack. 
>>>>>>
>>>>>> my function is def transition_form():
>>>>>>      for f, v in request.vars:
>>>>>>      db.table[f].default = v
>>>>>>  form = SQLFORM(db.table, user_signature=True)
>>>>>> return dict(form=form)
>>>>>>
>>>>>> Should I have extra values in the dict method?
>>>>>>
>>>>>  -- 
>>>>> Resources:
>>>>> - http://web2py.com
>>>>> - http://web2py.com/book (Documentation)
>>>>> - http://github.com/web2py/web2py (Source code)
>>>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>>>> --- 
>>>>> You received this message because you are subscribed to the Google 
>>>>> Groups "web2py-users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>> an email to [email protected].
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>  -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to