Gossamer Forum
Home : Products : DBMan SQL : Development, Plugins and Globals :

Modify only works on objects with primary keys

Quote Reply
Modify only works on objects with primary keys
In Dbsql::Home::modify_search_results(), there is a problem in the branch that emits several results with a radiobutton to indicate which one to modify. Normally, it emits "hidden"s for all primary keys, so you get e.g. type="hidden" name="Domain" value="gossamer-threads.com" (the search criteria).

But if the thing searched for is _not_ a primary key, no "hidden" is emitted, and the form sends along modify="2" (or whichever ordinal for the radiobutton), but it doesn't say _what_ second thing to modify. It ends up always offering to let you modify the first row in the entire table, since a fresh select has found them all. (Curiously, even if modify="2", it still wants to modify the first row of the table.)

It seems like this stuff isn't tested very well with tables lacking primary keys, although it deals gracefully (up to this point) with there being several things that matched one's search.

How can I get it to emit these other "hidden"s? I cannot simply make this field a primary key, as we have a legitimate need for duplicates here.