I went back to a plain vanilla view:
{{extend 'layout.html'}}
<h2>{{=request.args(0)}}</h2>
{{=form}}
{{if request.args(0)=='login':}}
<a href="{{=URL(r=request,args='register')}}">register</a><br />
<a href="{{=URL(r=request,args='retrieve_password')}}">lost password</a><br />
{{pass}}
it is does the same thing - I get the "Record Updated" flash message
but then the data goes back to the original data until I refresh the
browser.
-wes
On Wed, Nov 18, 2009 at 7:42 AM, Wes James <[email protected]> wrote:
> in the controller:
>
> @auth.requires_login()
> def profile():
> student=db(db.student.sid==user_id).select()
> 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)
>
>
> in the view
>
> /app/default/profile
>
> i have {{=form}}
>
> -wes
>
> On Wed, Nov 18, 2009 at 5:49 AM, selecta <[email protected]> wrote:
>>
>> i have part of the solution but a followup problem
>> so when you update the form is already created before the update, thus
>> if you do not update the from afterwards it shows still with the old
>> values
>> to fix this i wrote
>>
>> movie_form=SQLFORM(db.movie,12)
>> if movie_form.accepts(request.vars):
>> response.flash='changes sumitted'
>> movie.update_record(**dict(movie_form.vars))
>> movie_form=SQLFORM(db.movie,movie, formname='movie')
>>
>> but now i have the problem that it shows the values after the first
>> submission but still deletes the values on the second submission
>>
>> On Nov 18, 6:35 am, Wes James <[email protected]> wrote:
>>> I have this:
>>>
>>> student=db(db.student.sid==user_id).select()
>>> if (student):
>>> form=crud.update(db.student,student[0])
>>> else:
>>> form=crud.create(db.student)
>>>
>>> But when I do a submit to the form it comes back with the data, before
>>> the submit. If I refresh the browser window the correct values show
>>> up.
>>>
>>> Any idea why?
>>>
>>> thx,
>>>
>>> -wes
>> >>
>>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---