I used validation on my aspx
page, but it doesn't work and there is no error
<div class="fourm-container">
<div class="single-input">
<span>email</span>
<input name="" type="text" runat="server" id="email" />
<asp:RequiredFieldValidator ID="RVemail" runat="server"
ErrorMessage="*" ControlToValidate="email" Display="Dynamic"
ForeColor="Red" SetFocusOnError="True"
ValidationGroup="one"></asp:RequiredFieldValidator>
</div>
<div class="button-container">
<input type="submit" id="Submit" value="login" name="submit"
onclick="AddCustomer" runat="server" validationgroup="one" />
</div>
with the form tag and the closing div, I tried this snippet and could see the validation happening. (without the onclick) if you see it working, then the onclick has an issue.
<form id="form1" runat="server">
<div class="fourm-container">
<div class="single-input">
<span>email</span>
<input name="" type="text" runat="server" id="email" />
<asp:RequiredFieldValidator ID="RVemail" runat="server"
ErrorMessage="*" ControlToValidate="email" Display="Dynamic"
ForeColor="Red" SetFocusOnError="True"
ValidationGroup="one"></asp:RequiredFieldValidator>
</div>
<div class="button-container">
<input type="submit" id="Submit" value="login" name="submit" runat="server" validationgroup="one" />
</div>
</div>
</form>
You can't use ValidationGroup="one"
in RequiredFieldValidator
.
Try it:
<asp:RequiredFieldValidator ID="RVemail" runat="server"
ErrorMessage="*" ControlToValidate="email" Display="Dynamic"
ForeColor="Red" SetFocusOnError="True">
</asp:RequiredFieldValidator>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.