Hi again,
I’m once more stuck in a corner…
I’m using MMF and no problem but now I need to have a form with a file upload field.
First of all, if I understand correctly, MMF does not support these fields.
So I’ve downloaded the patch posted by dinhtrung (page 1 of this thread). I’ve also downloaded the example he posted but I couldn’t find any sign of MMF being used… doh!
My main model uses a function to init the form to be cloned, such as:
public function getMMFDocConfig()
{
return array(
'elements'=>array(
'booking_id'=>array(
'type'=>'hidden',
),
...
'document_filename'=>array(
'type'=>'file',
),
)
);
}
And in my view MMF works fine, with add/remove links and everything, for all child MMF’s.
In my controller I thus save this MMF the same way I do for the others child MMF.
if (... &&
MultiModelForm::save($bookingdoc,$validatedBookingdocs,$deleteBookingdocs,$bookingValues) &&
$model->save()) {
...
Problems are:
-
it seems I never get to execute this line in my controller when I save main model, turning off Ajax validation doesn’t change anything (a var_dump call placed right before MMF::save is never executed)
-
I’m then sent back to the edit form (not saved) and the file upload field shows error “filename can’t be blank”
-
I’ve also tried to manually add code to check for any CUploadedFile object, then I’ve checked MMF code and that should be done in there (by function initItems); with or without my code, nothing changes
Anybody has experience with these? Anyone could give hints or suggestions…?
TIA,
rash*
EDIT: meanwhile I’ve also tried another fork of MMF (by wandoledzep, that uses an older version of jquery relcopy) without success. It looks like I’m unable to find an example of using MMF with a file upload field…