General developer forum

 
 
Picture of Takeshi Matsuzaki
File picker's default value of select .
 

I made a repository plugin. It has a select box in a file picker .
I made this conde in print_login() .
-------
$iconsizes[] = (
array('value' => 0,'label' => 'small'),
array('value' => 1,'label' => 'big')
);
$iconsizes[1] = array_merge($iconsizes, array("selected"=> "true"));
//This line seems work well .

$maxicon = new stdClass();
$maxicon->id = 'aid';
$maxicon->type = 'select';
$maxicon->name = 'aname';
$maxicon->options = $iconsizes;

The default vaule was not set . Let me have a hint , please .

 
Average of ratings: -
Davo
Re: File picker's default value of select .
Group DevelopersGroup Particularly helpful Moodlers

If you take a look at the print_login function in 'filepicker.js', then scroll down to the section starting:

                } else if(l[k].type=='select') {

You will find that the options are set up with their value + content, but that there is currently no support for setting the 'selected' element (unless I've missed it, in which case my apologies to Marina who wrote that bit of code).

I think this looks like an improvement that should be posted in tracker.moodle.org (assuming it isn't there already - please search first).

 

 

 
Average of ratings: -
Picture of Takeshi Matsuzaki
Re: File picker's default value of select .
 

Hi Davo , thank you for your response .

I checked filepicker.js , as you said it doesn't support the default value in Moodle 2.4.3 and 2.5 beta .

And there seems no posting about it in tracker.moodle.org .

 
Average of ratings: -
Picture of Takeshi Matsuzaki
Re: File picker's default value of select .
 

I posted it as 'default value of select in filepicker'. Thank you for your advice .

Let me know one more about filepicker . I want to handle when one picture is selected in a filepicker . I can not find the call back function . I am happy if anyone gives me advice . 

 
Average of ratings: -