= Querying fields before merge = Sometimes it can be really nice (read: improve the user experience) to be able to query some fields without merging the value from the form back into an object. An example is when a user changes a input select field in a form which has an attached value. In an app we have, a user has a select list of product numbers. We make the app update the product's name on the page when the product changes. Note that we are treading on thin ice here: if the user has not entered a valid value for the field, when {{{get_value}}} tries to convert it to the appropriate type, it will raise an exception that will need to be dealt with. It is (generally) safe to reference values from a TextField or a SelectField though. {{{#!python class ProductFieldsetForm(FieldsetForm): products_menu = product_factory.all_products_menu() def __init__(self, product): self.product_id = product.product_id elements = ( Fieldset(( SelectField('Product code', self.products_menu, 'product_id', html_attrs={'onchange': 'javascript:product_form.submit()'}), StaticField('Product', product.name), )), ) FieldsetForm.__init__(self, 'Product selection', elements) self.load(product) def update(self): product_code_field = self.get_field('Product code') if self.product_id != product_code_field.get_value(): self.product_id = product_code_field.get_value() product = product_factory.product_with_product_id(self.product_id) product_field = self.get_field('Product') product_field.set_value(product.name) }}} The interesting part here is where we query the form for a specific field using its {{{get_field}}} method. We use the little bit of Javascript to make a change to the select list force an update to the page. That means having to name the form when we render the page: {{{#!html }}} In the app itself, we use: {{{#!python def page_enter(ctx): if not ctx.has_value('product_form'): ctx.locals.product_form = ProductForm(ctx.locals.product) ctx.add_session_vars('product_form') def page_process(ctx): ctx.locals.product_form.update() # update product name if product changed if ctx.request('save'): [...] }}}