Hello,

I'm developing an educational RIA for foreign language learners with
web2py.


I need users to submit their native language and the languages they are
learning when registering at the site.


For that I've added extra fields to the db.auth_user table.


The user's native language should be displayed in a select box, and the
languages he is learning shoud be displayed in a list box with multiselect
mode.


At registration time the select box and the list box are displayed fine.
The user can choose the appropriate languages and they get added to the
database.


The problem is with the native language select box. When the user goes to
his profile page nothing is selected in it. The user has to choose his
native language again if he wants to submit changes to his profile
information.


The list box with the languages he is learning is displayed fine - it has
all the user's languages selected.


Here's how I add the extra fields in my db.py:


db.define_table('native_language',Field('name'),format='%(name)s')

db.define_table('learn_language',Field('name'),format='%(name)s')


auth.settings.extra_fields['auth_user']= [

Field('native_language','list:reference native_language', requires =
IS_IN_DB(db,'native_language.id
',db.native_language._format,multiple=False)),

Field('learn_language','list:reference learn_language', requires =
IS_IN_DB(db,'learn_language.id',db.learn_language._format,multiple=True))

]


Tested with both web2py 1.99.7 and the trunk version, the latest Opera,
Safari, Chrome and Internet Explorer browsers on Windows.

-- 
Alexei Vinidiktov

Reply via email to