Kind of hard to explain. I am making a 3-party component that using the EmailRule to check for unique="true".
On save it will always fail with "Exception has occurred. UnexpectedValueException: The email address you entered is already in use. Please enter another email address."
The issue is that in the FormController in the save function we are not loading the form data. So when we get to the validation, the form data is always empty but the EmailRule is checking for form data to validate uniqueness.
The fix for it is to change:
to
$userId = (int) $input->get('id', 0);
This will check the submitted data instead of the form load data.
Be able to validate unique email
Exception has occurred.
UnexpectedValueException: The email address you entered is already in use. Please enter another email address.
dbserver: mysql
dbversion: 8.0.21-12.1
phpversion: 8.3.8
server: nginx/1.25.4
version: Joomla! 5.1.1 Stable [ Kudumisha ] 28-May-2024 16:00 GMT
Labels |
Added:
No Code Attached Yet
|
Labels |
Added:
bug
|
please check that $input
is not null
when creating the PR
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-07-22 14:22:17 |
Closed_By | ⇒ | richard67 |
As you know a fix, can you make a PR?