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"
validation="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.
I don't like this solution. But it is the only way I've found out. If you have a better solution to solve this problem. Please submit another pull request. Thanks!
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-11-24 05:39:38 |
Closed_By | ⇒ | tranduyhung |