Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

question template custom attributes buttongroup and singleselect

  • aellison9
  • aellison9's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 7 months ago - 5 years 7 months ago #173328 by aellison9
I have a custom question template where I am trying to capture custom attributes in the admin console when editing the question. It is very straight forward to add switch, integer, and text input types within the config.xml.

I cannot find examples or documentation on using buttongroup and singleselect which require an <options> list.

Here is the custom attribute section of my config.xml
Code:
    <custom_attributes>
        <!-- Provide an options under Slider to impact setup -->
        <attribute>
            <name>slider_min</name>
            <category>Slider</category>
            <sortorder>1</sortorder>
            <inputtype>integer</inputtype>
            <default>1</default>
            <help>Minumum value for the slider</help>
            <caption>Slider Minumum</caption>
        </attribute>
        <attribute>
            <name>slider_showminmax</name>
            <category>Slider</category>
            <sortorder>2</sortorder>
            <inputtype>switch</inputtype>
            <default>0</default>
            <help>Show Slider Min and Max below Slider</help>
            <caption>Display Slider Min and Max</caption>
        </attribute>
        <attribute>
            <name>slider_orientation</name>
            <category>Slider</category>
            <sortorder>3</sortorder>
            <inputtype>buttongroup</inputtype>
            <options>0='Horizontal'</options>
            <default>0</default>
            <help>Set the slider to slide vertically or horizontally</help>
            <caption>Set the orientation of the slider</caption>
        </attribute>
    </custom_attributes>

You can see in the last attribute where I am trying to define the "options" for the buttongroup. I've also tried nesting the "options" within the <inputtype> tags with no luck either.

I will also point out that if the syntax is incorrect, it will break the ability to see the options to set question attributes in the admin console. Also, with the "options' left blank, the caption will show for the attribute but no buttons are displayed. Screenshots below.

Config Info:
$config = '3.13.2';
$config = 353;
$config = '180709';
$config = true;
$config = '30049';

I would welcome any insight, advice or examples available to get this moving forward.

Thanks.
Last edit: 5 years 7 months ago by aellison9. Reason: Additional information provided
The topic has been locked.
  • aellison9
  • aellison9's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 7 months ago #173329 by aellison9
Found an example or two buried in the code base. Here is a snippet of a working buttongroup and singleselect in case anyone else stumbles upon this question.
Code:
    <custom_attributes>
        <!-- Provide an options under Slider to impact setup -->
        <attribute>
            <name>slider_min</name>
            <category>Slider</category>
            <sortorder>1</sortorder>
            <inputtype>integer</inputtype>
            <default>1</default>
            <help>Minumum value for the slider</help>
            <caption>Slider Minumum</caption>
        </attribute>
        <attribute>
            <name>slider_showminmax</name>
            <category>Slider</category>
            <sortorder>2</sortorder>
            <inputtype>switch</inputtype>
            <default>0</default>
            <help>Show Slider Min and Max below Slider</help>
            <caption>Display Slider Min and Max</caption>
        </attribute>
        <attribute>
            <name>slider_orientation</name>
            <category>Slider</category>
            <sortorder>3</sortorder>
            <inputtype>buttongroup</inputtype>
            <options>
                <horizontal>Horizontal</horizontal>
                <vertical>Vertical</vertical>
            </options>
            <default>horizontal</default>
            <help>Set the slider to slide vertically or horizontally</help>
            <caption>Set the orientation of the slider</caption>
        </attribute>
        <attribute>
            <name>slider_handle</name>
            <category>Slider</category>
            <sortorder>4</sortorder>
            <inputtype>singleselect</inputtype>
            <options>
                <round>Round</round>
                <square>Square</square>
                <triangle>Triangle</triangle>
                <custom>Custom</custom>
            </options>
            <default>round</default>
            <help>Set the slider to slide vertically or horizontally</help>
            <caption>Set the orientation of the slider</caption>
        </attribute>
    </custom_attributes>
The following user(s) said Thank You: DenisChenu, tpartner
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose