pylon's remote calls with formencode
Anil <[email protected]>
| Newsgroups | gmane.comp.python.formencode |
|---|---|
| Message-ID | <[email protected]> |
This is a repeat post done on Pylons groups, apologies if you've seen
this already.
What I am trying to do is a display a formencoded form in a DIV
element when I do a _remote helper call. Essentially, I want to do an
AJAX style form that is processed in a DIV element.
The problem is after the first rendering of the form, when I hit
submit, the form gets displayed in a whole new page instead of in the
DIV element... regardless of the form's validity.
template_file.myt:
<div id="Canvas"></div>
<% h.link_to_remote('New User...',
dict(update="Canvas",
url=h.url(controller='api', action='new', id='user'))
) %>
api.py controller:
def new(self, id):
# render the form
results, errors, response = formbuild.handle(
schema=model.forms.schema.NewContactUserFormSchema(),
template='/abook/new_user.myt',
form=model.forms.build.MainForm)
#pdb.set_trace()
# the form data was invalid, bail out and spit out errors
if response:
return response
return Response('Good form')
What are some options/alternatives? This can't be the only time
someone would ever do this?
Thanks!
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV