Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Bug in generate_full_down subroutine?

Quote Reply
Bug in generate_full_down subroutine?
In modul Relation::HTML.pm line #456 there is a bug (I think):

$selected = $home->{cgi}->{$rs->{pk}};

Has to be:

$selected = $home->{cgi}->{$rs->{fk}};

generate_full_down makes a drop down menu populated with values that are forign keys related to a primary table. The descriptions (options) in the drop down menu are taken from the primary table. The bug concerns the selected value. Now the value is selected that matches the primary key of the related table. But this makes no sense. The selected value has to be determined by the forign key of the related table.

primary table AUTHORS (pk: AuthID; description: Name)
related table BOOKS (pk: BookID; fk: AuthID)

If you want to change the author of a book and generate_full_down('AUTHORS','BOOKS') now AUTHORS.Name is selected with AUTHOR.id=BOOKS.pk. But we need AUTHORS.Name with AUTHOR.id=BOOKS.fk.


Subject Author Views Date
Thread Bug in generate_full_down subroutine? Armin 1994 Dec 2, 2002, 4:30 AM
Post Re: [Armin] Bug in generate_full_down subroutine?
604 1943 Dec 2, 2002, 10:01 AM