Bug 120603 - Misleading error messages resulting from fixes for bug #120353
Summary: Misleading error messages resulting from fixes for bug #120353
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
6.2.0.0.alpha0+
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Error-Messages
  Show dependency treegraph
 
Reported: 2018-10-15 08:23 UTC by tim
Modified: 2022-11-06 20:32 UTC (History)
6 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 tim 2018-10-15 08:23:51 UTC
It seems Base forms were not properly respecting the 'Input Required' setting on forms.  This was corrected in 6.1.3 (and later).

The result of this is that if a database field is defined as optional, but the corresponding form field is marked 'input required', the user is given an error message stating:

"Error writing to the database"
"Input required in field 'xyz'. Please enter a value".

This implies there's a database problem, when there isn't. There's a form problem.

This might not matter much in normal situations, but given the change (correction) in the behaviour of Base, I believe many will be seriously misled by this.  The fix can potentially affect hundreds of fields in many, many forms, and can be a lot of work to adjust to.  A misleading error message will cause problems, and probably more duplicate issue reports raised unnecessarily.
Comment 1 Alex Thurgood 2018-11-09 08:58:53 UTC
See also :

https://bugs.documentfoundation.org/show_bug.cgi?id=120712#c2
Comment 2 Xisco Faulí 2019-01-22 16:31:40 UTC
@Julien Nabet, Any opinion here?
Comment 3 Julien Nabet 2019-01-22 17:59:35 UTC
About "Input required in field 'xyz'. Please enter a value"., it's in https://opengrok.libreoffice.org/xref/core/include/svx/strings.hrc?r=c89a4996#1108

but "Error writing to the database" is nowhere to be seen in Opengrok so don't know where it comes from :-(
Comment 4 Lionel Elie Mamane 2019-01-22 18:01:13 UTC
AFAIR, the same message is used whether the restriction is in the form or in the database.
Comment 5 Lionel Elie Mamane 2019-03-21 13:08:25 UTC
Since LibreOffice 6.1.4 (and 6.2.0.0 from somewhere in early December 2018), odb files last saved by earlier versions of LibreOffice will have all form controls set to "Input required: no". See bug 120353 comment 27.

This should massively help to sidestep this.

Giving a different error message when the "input required" bit comes from the form or from the database can still be considered a worthy enhancement.
Comment 6 Julien Nabet 2019-03-21 13:35:55 UTC
(In reply to Lionel Elie Mamane from comment #5)
>...
> Giving a different error message when the "input required" bit comes from
> the form or from the database can still be considered a worthy enhancement.

If I understand well, you want to distinguish these 2 cases:
- xFirstControlWithInputRequired
- xFirstGridWithInputRequiredColumn
see https://opengrok.libreoffice.org/xref/core/svx/source/form/formcontroller.cxx?r=cec7ae9f#219

So in function FormController::approveRowChange
(cf https://opengrok.libreoffice.org/xref/core/svx/source/form/formcontroller.cxx?r=cec7ae9f#3706)
instead of:
3706              OUString sMessage( SvxResId( RID_ERR_FIELDREQUIRED ) );
3707              sMessage = sMessage.replaceFirst( "#", rColInfo.sName );
It would be something like:
OUString sMessage( xFirstControlWithInputRequired?SvxResId( RID_ERR_FIELDREQUIRED _DB):SvxResId( RID_ERR_FIELDREQUIRED_FORM ));

(or reuse RID_ERR_FIELDREQUIRED for DB and change the content to explicitly quote database and add RID_ERR_FIELDREQUIRED_FORM)
Comment 7 Xisco Faulí 2019-05-02 11:03:20 UTC
Moving to NEW
Comment 8 Robert Großkopf 2022-11-06 18:06:10 UTC
Isn't this bug already solved. Since https://bugs.documentfoundation.org/show_bug.cgi?id=150577 has been resolved it works as it should:

Form fields, which are created new, will be set to
Input required → no
by default.
If input is required by the database (defined in table) you will get a special error of your database. This error is always in English.
If input is set "required" in a form control, you will get an error message of the form. This error is in your GUI language and much more user-friendly like the error, which has been returned by the database.

All this is working well with LO 7.4.2.3. Shouldn't we close this bug?
Comment 9 Lionel Elie Mamane 2022-11-06 19:24:30 UTC
(In reply to Robert Großkopf from comment #8)

> If input is required by the database (defined in table) you will get a
> special error of your database. This error is always in English.

Yes, you are right, I think this has changed at some point. LibreOffice used to try to enforce the NOT NULL on the table itself (and give the same error message as when the _form_ requires a value), now it just lets the database deal with it. That's better because the database may have a trigger that chooses a value, or another mechanism that LibreOffice doesn't know about.

I don't immediately find the commit that did that, but it jogs my memory.

(Incidentally, some databases allow error messages to be in another chosen language, not only English.)
Comment 10 tim 2022-11-06 20:32:48 UTC
All OK by me.  Thanks.