Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

lib/formslib.php setAdvanced: Difference between revisions

From MoodleDocs
mNo edit summary
mNo edit summary
Line 15: Line 15:
Will set the header element miscellaneoussettingshdr and all the elements it contains to advanced.
Will set the header element miscellaneoussettingshdr and all the elements it contains to advanced.


If you set any button in a form to be an advanced item then ''''show / hide advanced' buttons are shown automatically''' in the form. Show / hide buttons are currently displayed at the top right of all fieldsets. The show / hide button shows or hides advanced controls using javascript or if no javascript is available then the whole page is submitted and redisplayed with advanced controls hidden or shown.
If you set any button in a form to be an advanced item then ''''show / hide advanced' buttons are shown automatically''' in the form. Show / hide buttons are currently displayed at the top right of all fieldsets containing advanced controls. The show / hide button shows or hides advanced controls using javascript or if no javascript is available then the whole page is submitted and redisplayed with advanced controls hidden or shown.

Revision as of 06:13, 19 December 2006

You can use MoodleQuickForm's method setAdvanced to specify a form element as an advanced option :

       $mform->addElement('select', 'display', get_string('displaymode', 'choice'), $CHOICE_DISPLAY);
       $mform->setAdvanced('display');

setAdvanced takes a second boolean parameter which defaults to true. True means set this control as an advanced control. False means it is not advanced.

       $mform->addElement('header', 'miscellaneoussettingshdr', get_string('miscellaneoussettings', 'form'));
       $mform->setAdvanced('miscellaneoussettingshdr');

Will set the header element miscellaneoussettingshdr and all the elements it contains to advanced.

If you set any button in a form to be an advanced item then 'show / hide advanced' buttons are shown automatically in the form. Show / hide buttons are currently displayed at the top right of all fieldsets containing advanced controls. The show / hide button shows or hides advanced controls using javascript or if no javascript is available then the whole page is submitted and redisplayed with advanced controls hidden or shown.