dolibarr
dolibarr copied to clipboard
Extrafields: no message displayed if a required extrafield is missing in the members autosubscription formular
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.
It seems that it's solved (version 11.0)
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.
Hello,
Have you tested with V13 ?
Hi,
You can re-open the issue if it is still relevant
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
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.
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.
Hello, I think it's fixed, can you check with the last version of 15.0.3
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);
todol_htmloutput_errors($errmsg); dol_htmloutput_events();