Hello, I'm writing a relatively big database application. A small part of it requires me to handle lists of values, where every list can only exist once, and where each item in the list can only exist once (but different lists can have items named the same way). A simplified model is:
db.define_table('lists', Field('name')) and db.define_table('list_items', Field('list',db.lists), Field('name')). (there exists more fields but they are irrelevant to the current case). I am now writing an interface to define new lists. I would like to use SQLFORM to generate the forms required. I would like to use the validators IS_NOT_EMPTY() and IS_NOT_IN_DB() to make sure there will not exist two lists with the same name. The problem is that I would also like to make a similar validation on the items of the list, but to restrict the IS_NOT_IN_DB() to a set containing the list items. In the book it gives an example using SQLFORM.factory() on how this should be done, but when I simply use SQLFORM(db.list_items) I don't know how to access the different fields to add a requires validator in the action. I've tried looking in the book and the group but was unable to find a way to do so. Thanks, Omri Har-Shemesh