General developer forum

Course Format Option for disable text box

 
Picture of Nilesh Pathade (eNyota Learning Pvt Ltd Pune)
Course Format Option for disable text box
 

Hi Moodle Community,


     I am  going to developed New course format plugin. I need simple text box which is default disable. can this possible after selecting my format while creating new course.


I am using like. : 

'location' => array(

                    'type' => PARAM_TEXT,

    ),

/*******************************/

'location' => array(

                    'label' => new lang_string('location', 'format_location'), 

                    'help' => 'location',

                    'help_component' => 'format_classroom',

                    'element_type' => 'text',

              ),


There is  "location" text box which I want set default value and it's should be disable.

Help Me.

 
Average of ratings: -
Picture of Mark Johnson
Re: Course Format Option for disable text box
Core developersParticularly helpful MoodlersPlugin developers

This is a guess from looking at existing course_format_options() methods, but try this:

'location' => array(
      'label' => new lang_string('location', 'format_location'),
      'help' => 'location',
    'help_component' => 'format_classroom',
      'element_type' => 'text',
'default' => $defaultvalue,
'element_attributes' => ['disabled' => true]
),

 
Average of ratings: Useful (1)
Picture of Nilesh Pathade (eNyota Learning Pvt Ltd Pune)
Re: Course Format Option for disable text box
 

Thank You Mark for reply.

It's working but just one change. 

'element_attributes' => array('disabled' => 'disabled'),

Thank you once again.  smile       

 
Average of ratings: -