## General developer forum

### File picker's default value of select .

File picker's default value of select .

I made a repository plugin. It has a select box in a file picker .
-------
$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: -
Re: File picker's default value of select .

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: -
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: -
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: -