In this article we will describe how to auto-populate a list with the name of the files in a folder of your choice.
The following script will function for RSForm! Pro revision 29 and previous revisions. In order to achieve this paste the following code to the "Items" text area:
//<code>
jimport('joomla.filesystem.folder');
$items = "|Please Select[c]\n";
$files = JFolder::files($RSadapter->config['absolute_path'].'/your_path_to_the_folder/');
$items .= implode("\n",$files);
return rtrim($items);
//</code>
In order to make the above script work in RSForm! Pro revision 30 and following revisions you will have to modify the following code line:
$files = JFolder::files($RSadapter->config['absolute_path'].'/your_path_to_the_folder/');
with:
$files = JFolder::files(JPATH_SITE.'/your_path_to_the_folder/');
Note:
The "Please Select" string will appear at the top of the list, the "[c]" option making it the default selected item.
The code tags(//<code> and //</code>) are mandatory for the script to work.






