On 17 January 2012 11:03, Christian Winterhager < [email protected]> wrote:
> Yes, thats clear. Until now i use a program, which is based on INFORMIXDB > with Python und CGI. In this program (respectively programs) i do exactly > that what you described above in your mail. It is not difficult to write > these programs but it is slow and boring. > > But now i know web2py and i wanted to use this tool and all of its > benefits to create more elegant forms and views. So my Question is again: > Is there any method to create an INPUT-Form (not for output, SELECT is > easy!) with CRUD or SQLFORM for the many-to-many Relation > "book-author-verb"? > > Or more precisely: is it possible to make a form with CRUD or SQLFORM, > which includes all fields of book and a listbox with autors, so that i can > select one or more authors and then klick the *only *submit-button of the > form to insert the book and the corresponding ids in table verb? I think > the problem is that we have 2 tables for CRUD/SQLFORM, which are not > directly connected via foreign keys (namely "book" and "author"). > In the 'verb' table you can use the type 'reference' for 'book' and 'list:reference' for authors (with the multiple-option). Then you can have a form using crud for input where you can select the book and the list of authors. See http://www.web2py.com/books/default/chapter/29/6?search=list%3Areference . I am working with a biliometric database and I have inserted constraints on database level to prevent the same combination of appearing in the linking table ('verb' in your case). I am working with Postgresql and found that the web2py-communications with the database breaks when this constraint complains. So I had to build in code to check for the existence of that combination of fields in the table before inserting it. Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3)

