Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the advantage of using the "validationtext" tag in the text element? #42919

Closed
balvard opened this issue Feb 29, 2024 · 3 comments
Closed

Comments

@balvard
Copy link

balvard commented Feb 29, 2024

Steps to reproduce the issue

In XML file we have a tag called "validationtext".
This element is not useful because it is not translatable.

Expected result

data-validation-text="Please fill Title"

Actual result

data-validation-text="TITLE_FILL_ELEMENT"

System information (as much as possible)

In the .ini file :
TITLE_FILL_ELEMENT="Please fill Title"

Additional comments

Please fix this file : layouts\joomla\form\field\text.php
At line : 98
!empty($validationtext) ? 'data-validation-text="' . $validationtext . '"' : '',
Change this line to this :
!empty($validationtext) ? 'data-validation-text="' . Text::_($validationtext) . '"' : '',
Thanks.

@Quy
Copy link
Contributor

Quy commented Mar 2, 2024

@dgrammatiko Hopefully you can provide additional information on this attribute. Thanks.
f0ba73a#diff-7195eb75172e6bd0b450db0f22c89a8a24d8e65afd2d06df17d83e7c278d4d0bR74

@dgrammatiko
Copy link
Contributor

The data-validation-text is used in the validation script (client side) in order devs to have the option to set a custom invalid state message PER FIELD:

const message = element.getAttribute('data-validation-text');

FWIW the platform itself with the newest native formvalidation supports a similar thing (although the attributes reflect the invalid state)

@Hackwar
Copy link
Member

Hackwar commented Apr 2, 2024

I created #43198 to fix this. Closing this issue. Thanks for your report.

@Hackwar Hackwar closed this as completed Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants