Bug 141016 - Dropdown list disabled in Form if no primary key defined in data model
Summary: Dropdown list disabled in Form if no primary key defined in data model
Status: RESOLVED WONTFIX
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
7.0.4.2 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsUXEval
Depends on:
Blocks:
 
Reported: 2021-03-14 09:59 UTC by frank.derville
Modified: 2022-04-06 13:35 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description frank.derville 2021-03-14 09:59:48 UTC
Description:
When creating a form with a dropdown list, my data (stored in MySQL database) had no primary key defined (nor foreign key). I was able to create the dropdown list. But when I used the form the list was empty and disabled. There was no error message.

Expected behavior : have an error message saying the a primary key should be defined on which field of which table.

Steps to Reproduce:
1. Create 2 tables with a common field but do not declare primary key
2. Create a form with first table
3. Add a dropdown list from the second table
4. See the result in Display mode

Actual Results:
The dropdown list is empty and disabled in the form

Expected Results:
An error message that helps identifying the issue and not lose time


Reproducible: Always


User Profile Reset: No



Additional Info:
When creating the dropdown list there should have been an error message
Comment 1 frank.derville 2021-03-14 10:01:11 UTC
Usability issue
Comment 2 Alex Thurgood 2021-03-15 08:52:16 UTC
@Frank : unfortunately, it is well known that a primary key is required in the table in order to allow writing to that that table. That requirement extends to controls to be able to fetch and allow writing to any given table bound to the form.

For example, in the online help :
https://help.libreoffice.org/6.0/he/text/shared/explorer/database/tablewizard03.html

"For some database systems within LibreOffice, a primary key is mandatory for editing the tables."


Also the FAQ:
https://wiki.documentfoundation.org/Faq/Base/009


and even the older OpenOffice.org forum documentation :

https://forum.openoffice.org/en/forum/viewtopic.php?f=83&t=26448


So I'm not really certain that this is an enhancement request that would even be accepted. 

Personally, I think it would be a useful addition to the UI experience, but the functionality you are requesting would require quite a lot of developer effort.
Comment 3 Heiko Tietze 2022-04-05 07:08:53 UTC
Could imagine a note in the status bar in the table editing window. Would that be of help, Frank?
Comment 4 Robert Großkopf 2022-04-05 08:34:44 UTC
Have tested this.
No problem to fill the dropdownlist.
The dropdownlist shows the connected value and is disabled because you can't change any content in GUI of Base for tables without a primary key in MySQL/MariaDB.
You could only see the content you imported, in my test two tables imported from Calc.

You will get this error message for a primary key when creating a table. Could be you didn't create the table in Base, so you couldn't get this message.
Comment 5 Heiko Tietze 2022-04-05 08:50:53 UTC
So let's resolve WF. Please reopen in case there is need for improvement.
Comment 6 Alex Thurgood 2022-04-06 13:35:16 UTC
My suggestion to Frank would be to file a new bug report, or seek out an existing report, and add comments to that existing report, about an enhancement request to support editing of data in mysql table through the LO user interface without the requirement for primary key.

The requirement for a primary key in order to be able to add/modify data in a table or linked tables is an artificial, and somewhat arbitrary, limitation imposed by the LibreOffice Database code. I don't believe that there is any easy fix to this either, but if it was someday implemented correctly, it would solve the problem exposed here by the OP.