# model
...
db.define_table('u',Field('name'))
db.define_table('v',Field('name'))
db.define_table('mytable',Field('x',u.id,requires=IS_IN_DB(db,'u.id')),Field('y',v.id,requires=IS_IN_DB(db,'v.id')))

# controller
...
  form=SQLFORM.factory(db.mytable)
  # ajax to update v when u is selected
  form.element('select#no_table_u')
['_onchange']="ajax('update/'+jQuery(this).val(),['v'],':eval');"
...
# and then later in the same controller
def update():
...
 
new_select_list=SELECT(...OPTION(...,_selected='selected'),OPTION(...),OPTION(...))
  return 'jQuery("#v").html("%s")'%new_select_list.xml()

ISSUE: The form displays OK. When I select a value from the first
field, u, the values shown in the second field, v, change dynamically,
as expected. I inspected the list of values for the v field and they
look OK. However, when I submit the form, the value of the v field is
always None. This happens whether or not I select a value from the v
pulldown or whether it defaults to the selected value in the SELECT
list.

What gives?

Reply via email to