dolibarr icon indicating copy to clipboard operation
dolibarr copied to clipboard

Extrafields: no message displayed if a required extrafield is missing in the members autosubscription formular

Open Jacques83300 opened this issue 4 years ago • 9 comments

Bug

When validating the members autosubscription formular (public/members/new.php) with missing required extrafields, no message is displayed, the formular is not validated (back to top of page) but a subscription request email is sent.

Environment

  • Version: 10.0.0
  • Web server: Apache

Expected and actual behavior

The autosubscription formular (public/members/new.php) does not have the same behavior for required Dolibarr standard fields and for the extrafields concerning the error messages: when a required Dolibarr standard field is missing, a message is displayed in red but when a required extrafield is missing, no error message is displayed but the formular is back to top, the data are not validated but a subscription request is sent by email. It is necessary to show an error message the same way as the standard Dolibarr fields if a required extrafield is missng. No email should be sent until the data are not validated and saved in the database.

Steps to reproduce the behavior

Use the standard autosubscription formular ((public/members/new.php) with mandatory extrafields.

Jacques83300 avatar Jul 25 '19 08:07 Jacques83300

It seems that it's solved (version 11.0)

RubenRuCh avatar Feb 03 '20 10:02 RubenRuCh

It seems that it's solved (version 11.0)

I'm testing with version 11.0.4 and this issue is still not fixed. After doing some checks in the code, it seems the errors are not managed the same way: the autosubscription formular is using the errmsg string to concatenate the errors to finally display them with a dol_htmloutputs_errors() in the View part. The extrafields errors are using the setEventMessages() function to store the errors. These error messages are only displayed when a new page is shown. Adding a dol_htmloutput_events() just after the dol_htmloutput_errors() would help but errors are show in to phases: first the errors on the standard fields then the errors on the extrafields. Ideally all errors should be managed the same way and all error messages should be displayed together.

Jacques83300 avatar May 30 '20 09:05 Jacques83300

Hello,

Have you tested with V13 ?

ksar-ksar avatar Feb 19 '21 09:02 ksar-ksar

Hi,

You can re-open the issue if it is still relevant

ksar-ksar avatar Mar 11 '21 21:03 ksar-ksar

Hi,

I just test it with V14.0.0 and the issue is still there: if a mandatory extra-filed is not filled, the formular stays displayed and is not sent but no message is displayed to explain the reason as for the other fields. Many thanks to fix this issue.

I don't know the way to re-open the issue

Jacques83300 avatar Aug 02 '21 07:08 Jacques83300

Thanks for the re-opening. Sorry, I made an incomplete description in my last comment: if mandatory fields are missing, the formular stays displayed without error message, the data are not stored in the member table but a confirmation email is sent to the user. The error message with the missing fields is only displayed when switching (or refreshing?) the site page.

Jacques83300 avatar Aug 02 '21 07:08 Jacques83300

Hi, I don't want to close the issue as, after testing with version 15.0.3, the issue is still not fixed. Can you please keep it open? Thanks.

Jacques83300 avatar Aug 03 '22 10:08 Jacques83300

Hello, I think it's fixed, can you check with the last version of 15.0.3

Hystepik avatar Sep 08 '22 10:09 Hystepik

Hello, I think it's fixed, can you check with the last version of 15.0.3

Hi, I upgraded to 15.0.3 but the issue is still there. I always need to change the code to fix the issue. The changes I made are in public/members/new.php:

  • precede block lines 308-430 by condition if (!$error) { if (!$error) { $result = $adh->create($user); if ($result > 0) { ... $error++; $errmsg .= join('<br>', $adh->errors); } } }
  • change line 488 dol_htmloutput_errors($errmsg); to dol_htmloutput_errors($errmsg); dol_htmloutput_events();

Jacques83300 avatar Sep 17 '22 16:09 Jacques83300