I want to hide (or disable) the submit button for an Ajax form, until a selection has been made from a DropDownList (@Html.DropDownList)
the form looks like this:
@using (Ajax.BeginForm("RoleAddToUser", "Roles", new AjaxOptions { InsertionMode = InsertionMode.Replace, UpdateTargetId = "middle_column", HttpMethod = "POST" }, new { id = "RoleAddToUserForm" }))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<p>
User : @Html.DropDownList("UserName", (IEnumerable<SelectListItem>)ViewBag.Users, "Select ...")
Role : @Html.DropDownList("RoleName", (IEnumerable<SelectListItem>)ViewBag.Roles, "Select ...")
</p>
<input type="button" name="SubmitBtn1" value="Send" onclick="$('#RoleAddToUserForm').submit(); " />
}
I assume that there is a way to detect that a value other than "select..." (the default one) has been chosen, and then to enable/show the submit button, using Javascript.
I also understand that this is probably trivial for most Js fans, but i dont normally work with cshtml or javascript, and this is very frustrating lol
If it helps, the file in question is cshtml from an mvc program.