User tests: Successful: Unsuccessful:
In back-end, when we edit a component's configuration, if we validate a field by using JFormRule and the validation fails, the field's label and the custom error message are not displayed because the language files of the component are not loaded.
Please make this small change to see this problem.
Add validation="email"
to purchase_type
field, the result looks like this:
<field
id="purchase_type"
name="purchase_type"
type="list"
label="COM_BANNERS_FIELD_PURCHASETYPE_LABEL"
description="COM_BANNERS_FIELD_PURCHASETYPE_DESC"
default="0"
validate="email"
>
Invalid field: COM_BANNERS_FIELD_PURCHASETYPE_LABEL
If you add message
attribute for custom error message and use a language key which only exists in Banners component, like this
<field
id="purchase_type"
name="purchase_type"
type="list"
label="COM_BANNERS_FIELD_PURCHASETYPE_LABEL"
description="COM_BANNERS_FIELD_PURCHASETYPE_DESC"
default="0"
validate="email"
message="COM_BANNERS_FIELD_PURCHASETYPE_DESC"
>
When you save the configuration, you get
Error
COM_BANNERS_FIELD_PURCHASETYPE_DESC
The problem is in validateField() of JForm (libraries/joomla/form/form.php), it doesn't load the language files of Banners component. This pull request is trying to do it.
Apply this commit, try again for the 2 cases above and you will get:
Invalid field: Purchase Type
Error
Select the type of purchase in the list.
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
Category | ⇒ | Administration |
Easy | No | ⇒ | Yes |
@designbengel The steps I posted was just for seeing the problem which is not about the validation, it is about the language files, they are not loaded when the validation is made.
@tranduyhung - yes but the steps don´t work... i don´t get any errors. Configuration is saved without Errors.
@designbengel I still can see this problem in Joomla 3.5.1.
testinstructions are wrong... must be: validate="email", stated: validation="email"
I have tested this item successfully on 24096bb
patch OK, testinstructions wrong (validation instead of validate)
Thank you @henkrijneveld The first step's instruction was wrong. My bad! Didn't notice it. The second one is correct.
I have tested this item successfully on 24096bb
I have tested this item successfully on 24096bb
Thanks for the correction on the instructions @henkrijneveld
Status | Pending | ⇒ | Ready to Commit |
Labels |
Added:
?
|
Milestone |
Added: |
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-04-15 15:26:20 |
Closed_By | ⇒ | rdeutz |
Labels |
Removed:
?
|
Milestone |
Removed: |
Milestone |
Added: |
Milestone |
Added: |
Milestone |
Removed: |
I can´t reproduce the first two steps. Anything to add before to make the validation work?
thanks!
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8529.