我有一个包含其他表单的表单。 第一种形式将数据发送到beginform中指示的动作,该动作包含它所包含的特定形式。 第二种形式(包含在第一种形式)是一个列表,在更改事件,交换图片,这是有效的。 但第一种形式尚未发送。
我怎样才能提交第一个表格normaly和第二个javascript更改?
@using (Html.BeginForm("VCreateCommande", "CCommande", new {id="formretouche"}, FormMethod.Post, new { enctype = "multipart/form-data" }))
{
var imagedefaut = "";
@Html.AntiForgeryToken()
<h4>Retouchephoto</h4>
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group ilnblk">
<div class="control-label col-md-2 fltleft">Type de retouche</div>
<div class="col-md-10 fltleft">
@using (Html.BeginForm("VCreateCommande", "CCommande", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.DropDownListFor(model => model.Ttyperetouche.Idtyperetouche, new SelectList(
Model.Ttyperetouches, "Idtyperetouche", "libelle", ViewData["Idtyperetouche"]), new { @onchange = "this.form.submit()" })
} </div>
<div class="fltleft imagemodele">
@if (ViewData["Idtyperetouche"] != null)
{
foreach (var typeretouche in Model.Ttyperetouches)
{
if (typeretouche.Idtyperetouche.ToString() == ViewData["Idtyperetouche"].ToString())
{
imagedefaut = typeretouche.SRCtyperetouche;
}
}
}
else
{
imagedefaut = Model.Ttyperetouches.First().SRCtyperetouche;
}
<img src="@imagedefaut" />
</div>
</div>
<div class="form-group">
<div class="control-label col-md-2">Support papier</div>
<div class="col-md-10">
@Html.CheckBoxFor(model => model.Tretouche.Supportpapier, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Tretouche.Supportpapier, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="control-label col-md-2">Quantité</div>
<div class="col-md-10">
@Html.EditorFor(model => model.Tretouche.Quantite, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Tretouche.Quantite, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="control-label col-md-2">Photo...</div>
<div class="col-md-10">
@Html.TextBoxFor(model => model.Tretouche.fichierphoto, new { type = "file" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
@{
String onclick = String.Format("Submit(this)",
Html.Encode(ViewBag.returnUrl));
}
<input type="button" id="btnsubmitretouche" value="Ajouter1" onclick="@onclick" />
<input type="submit" value="Ajouter" class="btn btn-default"/>
</div>
</div>
}