我有搜索框并在一个页面中添加和编辑按钮。选择单选按钮后我必须编辑详细信息。选择单选按钮并重定向到下一页的脚本如下所示。但只有“选择简历”的警报才有效。其余的代码不起作用。请帮助
<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>