我有一個搜索框,並在一個頁面中添加和編輯按鈕。選擇單選按鈕後必須編輯一個細節。選擇單選按鈕並重定向到下一頁的腳本如下所示。只有警惕「選擇的簡歷只有works.rest的代碼是不是working.Pls幫助在mvc3中選擇單選按鈕後重定向到另一個頁面
<script type="text/javascript">
$(document).ready(function() {
var which_button;
var rad;
$('input[type="image"]').click(function (event) {
process_form_submission(event);
if (which_button == "Edit") {
if (!$("input[name='rdoUserId']:checked").val()) {
alert('Select a Resume!');
return false;
}
else {
rad = $("input[name='rdoUserId']:checked").val();
var url = "Edit/" + rad;
$('#frmIndexResume').attr("action", url);
$('#frmIndexResume').submit();
}
}
return false;
})
function process_form_submission(event) {
event.preventDefault();
//var target = $(event.target);
var input = $(event.currentTarget);
which_button = event.currentTarget.value;
}
});
</script>
<form name="frmIndexResume" method="get"action="">
<table id="tblSearch">
<tr>
<td>Name:@Html.TextBox("Names")</td>
<td>From:@Html.TextBox("FromDate")</td>
<td>To:@Html.TextBox("ToDate")</td>
<td><input type="image" value="Search" src="@Url.Content("~/images/Search.png")" width="60px"height="40px" alt="Search"/></td>
</tr>
</table>
<table id="Createbtn">
<tr>
<td>
<a href="@Url.Action("Create", "Resume")" title="Create">
<img src="@Url.Content("~/images/Create.png")" width="40px" height="30px"alt="Create"/></a>
</td>
<td>
<input type="image" value="Edit" src="@Url.Content("~/images/Edit.png")" width="40px" height="30px" alt="Edit"/>
</td>
</tr>
</table>
<table id="tblResume">
<caption>Listings</caption>
<tr>
<th>Select</th>
<th>
Name
</th>
<th>
DOB
</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
<input type="radio" value="@item.Id" name="rdoUserId" />
</td>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.DOB)
</td>
</tr>
}
</table>
</form>