I'm having some problems thinking of a solution to this issue. Basically I would like to disable my submit/save button if the user has not selected a value from a dropdown list that I have. When the page loads, it defaults to the "-Select-" option, but I'm getting server errors if the user forgets to actually select an option. The only way to do so that I can think of is what I mentioned before, disable the submit/save if they haven't selected a value and the "-Select-" option is still selected. Any suggestions?

            <tr>
            <td class="fieldName_td">
                @Html.Label("Copy Internal Form Group Actions:")<span class="requiredField">*</span>
            </td>
            <td class="fieldData_td">
                <div id="form_shower">
                    <select id="myselect" name="ddlInternalAssociations">
                        <option value="4" selected="selected">-Select-</option>
                        <option value="1">Remove the association</option>
                        <option value="2">Copy and create new association</option>
                        <option value="3">Maintain the old association</option>
                    </select>
                </div>

                <div class="show-hide" name="form_name1" id="form_name1" style="display:none">

                </div>

                <div class="show-hide" name="form_name3" id="form_name3" style="display:none">

                </div>

            </td>
        </tr>

        <tr>
            <td class="fieldName_td">
                <div class="show-hide" name="form_name2" id="form_name2" style="display:none">
                    @Html.Label("Name for newly created internal form group:") 
                </div>
            </td>
            <td class="fieldData_td">
                <div class="show-hide" name="form_name4" id="form_name4" style="display:none">
                    <input id="newInternalFormName" name="newInternalFormName" type="text" value="@Model.DetailObject.SuggestedInternalFormName" size="25" />
                </div>
            </td>
        </tr>
    }
    <tr>
        <td class="fieldName_td"></td>
        <td class="fieldDataCenter_td">

            @Html.HiddenFor(p => p.returnUrl)
            @Html.HiddenFor(p => p.DetailObject.FormGroupId)
            @Html.NWFormSubmitButtonFor(model => model, "btn_SaveButton", "Save", "btn_SaveButton", "SaveCollection", "disableOnSubmit")

        </td>
    </tr>

Related posts

Recent Viewed