0

Currectly I am creating a page which has many @Html.TextBoxFor and @Html.DropDownList. Based on the value entered in it the submit button should be enabled. I tried required but it doesn't work for me. Only if the values are entered in the fields the submit button should be enabled. Any help please?

Html code snippet:

<div class="col-md-6">
    <div class="form-group">
        <label class="control-label col-lg-4">Period:<span class="Imp">*</span></label>
        <div class="col-lg-8">
            @Html.DropDownList("Quarter", new SelectListItem[] { (new SelectListItem() { Text = "Q1", Value = "1" }), (new SelectListItem() { Text = "Q2", Value = "2" }), (new SelectListItem() { Text = "Q3", Value = "3" }), (new SelectListItem() { Text = "Q4", Value = "4" }) }, "-- Select Quarter --", new { @class = "form-control", id = "Quarter", @required = "required" })
        </div>
    </div>
</div>

<div class="col-md-6">
    <div class="form-group">
        <label class="control-label col-lg-4">ID:<span class="Imp">*</span> </label>
        <div class="col-lg-8">
            @Html.TextBoxFor(model => model.detailsConfig.ID, new { @class = "form-control", id = "ID", @required = "required" })
        </div>
    </div>
</div>

<input type="submit" id="btnSubmit" value="Submit" class="btn btn-lg btn-success" />
Global
  • 11
  • 1

0 Answers0