I'm using FileDOM to add a document library to a site. I've got the system setup with DOM and Uploadify so that I can add files and then continue to fill in each files custom information which includes a description text field and category select field the document.
I know the assets system renames the physical file if there are spaces when it uploads the file and uses the original file name as the file title. Is it possible to populate the description field with the file title or perhaps expose File.Title to DOM so they can either accept the default title as the description or edit it?
This is the dataobject code:
class LibraryTab extends DataObject {
static $db = array(
'Description' => 'Text',
'Category' => "Enum('Air, Metals, Organics, Wet Chemistry')"
);
static $has_one = array(
'LibraryFile' => 'File',
'LibraryPage' => 'LibraryPage'
);
public function getCMSFields_forPopup(){
return new FieldSet(
new TextField('Description','File Description',$this->File.Title),
new DropdownField('Category','File Category', singleton('LibraryTab')->dbObject('Category')->enumValues())
);
}
}
I can see that the upload happens and the assets are added to the table and then their IDs are stored to used as you continue through the rest of the form fields. Is there a way to get that ID as it generates each files form view and use it to call something like File::get()->byID(#) and use the result to populate the description field?
Any help would be appreciated.
Thank you.