It's kind of redundant but you need to tell crud.update to redirect
back to itself using 'next':

form=crud.update(db.student,student[0],next=URL(r=request))


On Nov 18, 11:27 am, Wes James <compte...@gmail.com> wrote:
> pulled latest trunk
>
> put this in db.py
>
> db.define_table("student",
>     SQLField("last_name","string",length=30,default=auth.user.last_name
> if auth.is_logged_in() else '',requires=[IS_NOT_EMPTY()]),
>     SQLField("first_name","string",length=30,default=auth.user.first_name
> if auth.is_logged_in() else '',requires=[IS_NOT_EMPTY()]),
>     SQLField("middle_name","string",length=30,default=""),
>     
> SQLField("preferred_name","string",length=30,default="",requires=[IS_NOT_EMPTY()])
>     )
>
> put this in default.py
>
> def profile():
>     student=db(db.student.id==1).select(db.student.ALL)
>     if (student):
>         form=crud.update(db.student,student[0])
>     else:
>         form=crud.create(db.student)
>     if form.errors:
>         response.flash="There was an error submitting the form!
> Please check for any errors below the fields."
>     return dict(form=form,response=response)
>
> I created default/profile.html
>
> {{extend 'layout.html'}}
> {{=form}}
>
> first time form comes up blank  - fine - put some data in press enter
> - the form is blank - refresh screen, the data is there, including
> delete checkbox.
>
> Shouldn't this bring up the form with the data filled in after a
> submit/update/insert?
>
> -wes
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to