I think you need

form.accepts(.....,keepvalues=True)

On Feb 28, 3:42 am, murray3 <[email protected]> wrote:
> I have a test Wiki Controller which now defines a form with the
> properties
> I can customise, I have a text area which is edited by nicEdit. On
> submit
> saves contents to my db. and can be dispalayed on another page with
> {{=XML(page.body,sanitize=True)}}
> while this is OK, when clicking submit, the code clears the textarea
> on submit.
> If I click submit again it will display the previous saved/displayed
> data.
> A third iteration of above process and the cleared textarea will be
> submitted and
> so "erase" the previous data.
>
> I need to stop the code "clearing" the textarea on submit, should be
> ok after that,
> but how???
>
> here is controller code:
>
> def edit():
>                 try: thispage=db(db.page.id==request.args[0]).select()[0]
>                 except: redirect(URL(r=request,f='index'))
>                 form=FORM(DIV(TEXTAREA(_style="width: 98%;", 
> _name="wikibody1",
> _id="wikibody1",_value=XML(thispage.body,sanitize=True))),INPUT
> (_type="submit",_value="Save"))
>                 if form.accepts(request.vars,session):
>                         thispage.update_record(body=form.vars.wikibody1)
>                         response.flash="form accepted!"
>                 elif form.errors:
>                         response.flash="form is invalid!"
>                 return dict(form=form,page=thispage)
>
> thanks
> chrism
> p.s. I do read as much of the documentation to try and solve these
> problems, but some of the syntax is still in a "black box" - when I
> have time I will learn the underlying code but it would be nice to
> just get some stuff working and get some pos' feedback.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to