Ok... I found the mistake:

db.answers.card_id.requires=IS_IN_DB(db(db.card.subject_id == subject_id),*
'card.id',*'card.question')



On Monday, October 15, 2012 6:44:23 PM UTC+2, jw wrote:
>
> Some time ago, I had this problem: 
> https://groups.google.com/forum/?fromgroups=#!searchin/web2py/pre-selected/web2py/gqB4Pfa-YbA/XpFjvNuHcykJwhich
>  turned out, as an Design-Problem which I solved (with a little bit of 
> help by a friend).
> Now I have a different issue in the same form. 
>
> In my database, there are many questions related to many subjects. But 
> every question ist related to one single subject. A question has card_id 
> for example "7" and a name as a string like "Physik".
> To add new answers to questions a user selects in a first form which 
> subject he wants to work on. In the next page he should see in a form only 
> the questions from the selected subject.
> To preselect a question in this form I use:
>
> db.answers.card_id.requires=IS_IN_DB(db(db.card.subject_id == subject_id),
> 'card.question') #http://markmail.org/message/wbfkxq4gw377owd2
>
> But then, when I press the submit-button to create a new entry in the 
> database, I get the corresponding string which is related to card_id, and 
> not the requested card_id.
>
> Whithout this line, I see all the questions as a string and after pressing 
> submit, the new entry in the database is created correctly with the card_id.
> But then, the user sees ALL the questions. That is to uncomfortable.
>
> Any idea?
>
>
>

-- 



Reply via email to