? Success

User tests: Successful: Unsuccessful:

avatar tranduyhung
tranduyhung
24 Nov 2015

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.

  1. Open administrator/components/com_banners/config.xml
  2. 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"
        >
    
  3. Edit Banners's configuration, save and you get this error message:

Invalid field: COM_BANNERS_FIELD_PURCHASETYPE_LABEL

  1. 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!

avatar tranduyhung tranduyhung - open - 24 Nov 2015
avatar tranduyhung tranduyhung - change - 24 Nov 2015
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 24 Nov 2015
Labels Added: ?
avatar tranduyhung tranduyhung - change - 24 Nov 2015
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2015-11-24 05:39:38
Closed_By tranduyhung
avatar tranduyhung tranduyhung - close - 24 Nov 2015
avatar tranduyhung tranduyhung - close - 24 Nov 2015
avatar tranduyhung tranduyhung - head_ref_deleted - 24 Nov 2015

Add a Comment

Login with GitHub to post a comment