0

I would like to do this in my config.xml of my component:

    <field  name="allowedfiletypes" 
            type="list" 
            multiple="true"
            label="COM_BESTIA_FIELD_ALLOWEDFILETYPES"
            description="COM_BESTIA_FIELD_ALLOWEDFILETYPES_DESC">
            <option value="png">PNG</option>
            <option value="jpeg">JPEG</option>
            <option value="jpg">JPG</option>
            <option value="gif">GIF</option>
            <option value="pdf">PDF</option>
            <option value="zip">ZIP</option>                                                
    </field>        

Unfortunately the com_config does not save multiple values here. If I do not use multiple=true it works (but only saves one value as you can see here http://d.pr/1fulC).

With Field type "user group" the multiple-tag works without problems.

Am I doing anything wrong here?

  • This exact code works for me on Joomla! 3.4.1. See screenshot. This is after saving, not selected. – Rene Korss Aug 3 '15 at 12:26
1

I haven't looked too much into multiple="true" but an alternative could be using a text box and separating each value with a comma, like so:

<field name="allowedfiletypes" 
       type="text" 
       label="COM_BESTIA_FIELD_ALLOWEDFILETYPES"
       description="COM_BESTIA_FIELD_ALLOWEDFILETYPES_DESC"
       default="png,jpg,jpeg,gif,pdf,zip" />

You could then if you like save the value as 1 json encoded string

  • Hm, okay. That would be possible. But isn't it planned for future? Because userlist-type is already able to save multiple values. – MyFault Aug 3 '15 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.