6 messages in com.googlegroups.pylons-discussRe: confusion with FormBuild
FromSent OnAttachments
dykang26 Sep 2006 21:42 
James Gardner27 Sep 2006 06:02 
dykang27 Sep 2006 16:46 
Anil27 Sep 2006 16:52 
James Gardner28 Sep 2006 04:33 
Sergey Lipnevich29 Sep 2006 08:06 
Subject:Re: confusion with FormBuild
From:dykang (dyk@gmail.com)
Date:09/27/2006 04:46:17 PM
List:com.googlegroups.pylons-discuss

James,

Thanks for your response. I am not actually sure about the answers to your questions. I believe they are yes, yes, and no. But I'm not entirely sure. I went back and created the smallest pylons project that I could that demonstrated the behavior, and I am able to reproduce it regularly. Here are the steps if you are interested.

====================================================== paster create --template=pylons helloworld cd helloworld/helloworld/controllers paster controller formbuild_test

for simplicity sake, create form/schema in place open up formbuild_test.py and make it look like this:

from helloworld.lib.base import * import formencode import formbuild

class StandardForm(formbuild.Form): pass

class EmailFormSchema(formencode.Schema): allow_extra_fields = True filter_extra_fields = True email = formencode.validators.Email(not_empty=True) age = formencode.validators.Int(not_empty=True)

class FormbuildTestController(BaseController): def email_form(self): results, errors, response = formbuild.handle( schema=EmailFormSchema(), template='email_form.myt', form=StandardForm ) if response: return response return Response( 'You are %s years old and have the following email: %s'%( results['age'], results['email'], ) )

then go create a template cd ../templates create a file email_form.myt that looks like this:

<% c.form.start(name="form", action=h.url_for(action='email_form'), method="GET") %> <% c.form.layout.simple_start() %>

<% c.form.layout.entry( c.form.field.text('email'), name='Email', error=c.form.get_error('email') ) %>

<% c.form.layout.entry( c.form.field.text('age'), name='Age', error=c.form.get_error('age') ) %>

<% c.form.layout.entry( c.form.field.submit('submit', value="Submit") ) %>

<% c.form.layout.simple_end() %> <% c.form.end() %>

then serve the page and hit http://<domain>/formbuild_test/email_form from one machine. fill out the form with an email address and age so that the submission doesn't error

then visit http://<domain>/formbuild_test/email_form from another machine (i've tried safari and firefox) notice that the form is filled out with the data provided on the first submission.

if you don't have two machines available, you can witness the same behavior with different browsers. I used different browsers because it's easy to prove that they are different processes and not sharing any caching that way.