x

Main chapters

  1. LimeSurvey Cloud vs LimeSurvey CE
  2. LimeSurvey Cloud - Quick start guide
  3. LimeSurvey CE - Installation
  4. How to design a good survey (Guide)
  5. Getting started
  6. LimeSurvey configuration
  7. Introduction - Surveys
  8. View survey settings
  9. View survey menu
  10. View survey structure
  11. Introduction - Questions
  12. Introduction - Question Groups
  13. Introduction - Surveys - Management
  14. Survey toolbar options
  15. Multilingual survey
  16. Quick start guide - ExpressionScript
  17. Advanced features
  18. General FAQ
  19. Troubleshooting
  20. Workarounds
  21. License
  22. Version change log
  23. Plugins - Advanced
 Actions

Defining attributes

From LimeSurvey Manual

Defining attributes for question types.

Attributes for question types are all configurable, non default, aspects of a question. A good example of an attribute is question text.

Question attributes are defined using an array with the name of the attribute as a key. An attribute definition supports several keys.

  • type - string: The data type of the attribute. Supported types are ('html', 'string', 'boolean', 'select')
  • localized - boolean: Whether this attribute should be configurable per language.
  • advanced - boolean: Whether this attribute should be shown in the default or advanced tab.
  • label - string: The label of the attribute in English (this is localized by the admin interface).
  • options - array(string-string): Contains the options for an attribute of type 'select'.
  • default - mixed: Contains the default value for the attribute.

Example:

protected $attributes = array(

   'question' => array(

       'type' => 'html',

       'localized' => true,

       'label' => 'Question text:'

   ),

   'help' => array(

       'type' => 'html',

       'localized' => true,

       'label' => 'Help text:'

   ),

   'mandatory' => array(

       'type' => 'boolean',

       'label' => 'Mandatory:'

   ),

   'display' => array(

       'label' => 'Display using:',

       'type' =>  'select',

       'options' => array(

           'radio' => 'Radio buttons',

           'dropdown' => 'Dropdown list'

       ),

       'localized' => false,

       'advanced' => false,

       'default' => 'dropdown'

   )

);