I need some help with file uploading using AjaxHelper.
I'm doing it this way:
this is my view:
$AjaxHelper.BuildFormRemoteTag( "$siteRoot/ajaxcollectivea/AddNewCADoc.rails", $DictHelper.CreateDict( "failure=error","with= Form.Serialize(this)", "loading=Toggle.display('status');$('status').innerHTML='Saving...'", "interactive=$('status').innerHTML='Completed'","success=output","complete=displayWindow('output','Add New Collective Agreement - General',400,200);") )
<table>
<tr>
<td>Name</td>
<td>
$HtmlHelper.InputText("caname",$ca.Name)
</td>
</tr>
<tr>
<td>Agreement Type</td>
<td>
$HtmlHelper.Select('agreementId')
$AgreementTypeHelper.GetAllATypeOptions($ca.AgreementType)
$HtmlHelper.EndSelect()
</td>
</tr>
<tr>
<td>Start Date</td>
<td>
<input type="text" name="startDate">
</td>
</tr>
<tr>
<td>End Date</td>
<td>
<input type="text" name="endDate">
</td>
</tr>
<tr>
<td>Document Type</td>
<td>
$HtmlHelper.Select('docTypeId')
$HtmlHelper.CreateOptionsFromArray($dtypes, "Name", "DocTypeId",$ca.DocType)
$HtmlHelper.EndSelect()
</td>
</tr>
<tr>
<td>Document</td>
<td>
$HtmlHelper.InputFile("document")
</td>
</tr>
</table>
$HtmlHelper.SubmitButton("Next >>")
$HtmlHelper.EndForm()
and my controller:
public void AddNewCADoc(string caname,int agreementId,int docTypeId, DateTime startDate, DateTime endDate,HttpPostedFile document)
{
CollectiveAgreement ca = GetCAFromSession(Session);
AgreementType atype = AgreementType.Find(agreementId);
DocType dtype = DocType.Find(docTypeId);
ca.Name = Params["caName"];
ca.AgreementType = atype;
ca.StartDate = DateTime.Parse(Params["startDate"]);
ca.EndDate = DateTime.Parse(Params["endDate"]);
ca.Status = 0;
SetCAToSession(ca,Session);
AddNewCA();
}
Now all the fields are binded properly but only document is null.
Any ideas, what I'm doing wrong?
Thanks,
Mircea
_______________________________________________ CastleProject-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/castleproject-users
