since 2 days I'm working at the same problem and finally i think this could be an bug.
I try to render an view, with 2 CActvieForm Widgets. One of the widget contains an fileField to upload a file.
I use this example to build the code:
The Point is: if i upload an file using the CActiveFrom with an ajaxSubmitButton, than the validation says:
"Z cannot be blank" (where Z is the Attribute).
This is correct, because if i look at firebug, is see nothing is transmitted to the action. (The variable myModel[Z] is empty). But ifI use the same form with an textField instead an fileFilde, then everything works fine.
After reading this post (where an user has the same problem)...
...I use renderPartial instead of render and: everything works, also uploading an file.
So i decided to use renderPartial to render the form, followed by an render for the rest of the layout, like this.
$this->renderPartial('_index_uploadForm',array( 'myModel'=>$myModel )); $this->render('_index',array( ));
Now, upload does not work, the uploaded file is not part of the post request (myModel[Z] is empty again)
Finlay i tried to renderPartial the uplaodForm AND renderPartial the rest of the layout:
$this->renderPartial('_index_uploadForm',array( 'modelUpload'=>$modelUpload )); $this->renderPartial('_index',array( ));
...the upload works, but the application/webpage Layout is not complete (because render() is never used)
Does anyone has an idea what happened here?
Thank you, rall0r