如何将输入标记中的Required更改为false

时间:2014-04-21 12:40:02

标签: vb.net html5 vbscript

我有这个HTML代码,想要按下后退按钮而不需要输入数据,因此可以将其重定向回上一页,需要在vb.net中。

<form runat="server">
    <table>
        <tr><td>First Name:</td><td><input type="text" id="first" runat="server" Required/></td>
        <td>Surname:</td><td><input type="text" id="last" runat="server" Required/></td></tr>
        <tr><td>Date of Birth:</td><td><input type="date" id="birth" runat="server" Required/></td>
        <td>Gender:</td><td><select id="gender" runat="server" Required><option>Male</option><option>Female</option></select></td></tr>
        <tr><td>Known Illnesses:</td><td><input type="text" id="illnesses" runat="server" Required/></td>
        <td>Nationality:</td><td><input type="text" id="country" runat="server" Required/></td></tr>
        <tr><td>Email:</td><td><input type="email" id="mail" runat="server" Required/></td>
        <td>Mobile:</td><td><input type="number" id="phone" runat="server" Required/></td></tr>
        <tr><td>Employer:</td><td><input type="text" id="company" runat="server" Required/></td>
        <td>Emergency Contact Name:</td><td><input type="text" id="emergencyperson" runat="server" Required/></td></tr>
        <tr><td>Emergency Contact Number:</td><td><input type="number" id="emergencyphone" runat="server" Required/></td>
        <td><input type="submit" id="btnUpdate" value="Update" runat="server" /></td>
        <td><input type="submit" id="btnBack" value="Back" runat="server" /></td></tr>
        </table>
        <p id="parMsg" runat="server"></p>
    </form>

1 个答案:

答案 0 :(得分:0)

您必须删除required属性。如果存在,则<input>需要数据。