I'm working with Bootstrap. I created a master page and the general purpose is to store the input from user in the contact form (name, email, message,...), captcha used also:
<!-- Omitted -->
<asp:TextBox ID="txtName" runat="server" CssClass="form-control" placeholder="Name*" required data-validation-required-message="Please enter your name." />
<!-- CAPTCHA -->
<asp:TextBox ID="txtCaptcha" runat="server" Width="200px"/>
<asp:Image ID="imgCaptcha" runat="server" />
<asp:Button ID="btnRefresh" runat="server" Text="Refresh" OnClick="btnRefresh_Click" />
<!-- SUBMIT BUTTON -->
<asp:Button runat="server" ID="submit" Text="Send Message" CssClass="btn btn-xl" OnClick="submit_Click" />
The code inside submit_Click does not work for me:
protected void submit_Click(object sender, EventArgs e)
{
//Check captcha
if (Session["captcha"].ToString() != txtCaptcha.Text)
Response.Write("Invalid Captcha Code");
else
Response.Write("Valid Captcha Code");
FillCapctha(); //Reload text
//Store input into database
Contact contact = new Contact();
contact.name = txtName.Text;
contact.message = txtMessage.Text;
}
Nothing works here. Someone has suggestions? I'll appreciate much!
Suggestions : It looks like you are using jquery validations(required) on page. Check errors using firebug. There is possibility that due to some JS issues(may be bootstrap js) it does not process.