3

I've implemented a BotDetect MVC CAPTCHA‎ i my project. I wanna validate the captcha textbox as usual. I am using bvalidator for the validation in my project. I don't know how to implement bvalidator to the captcha textbox.

This is my View

 @using (Html.BeginForm("Index", "Login", FormMethod.Post, new { id = "signupform" }))
            {
                <h2>Sign Up</h2>
                <hr class="colorgraph">
                <div class="form-group">
                    <input type="text" name="NewUserFirst_Name" id="NewUserFirst_Name" class="form-control input-lg" placeholder="First Name" tabindex="1" data-bvalidator="required" data-bavalidator-msg="First Name">
                </div>
                <div class="form-group">
                    <input type="text" name="NewUserLast_Name" id="NewUserLast_Name" class="form-control input-lg" placeholder="Last Name" tabindex="2" data-bvalidator="required" data-bavalidator-msg="Last Name">
                </div>
                <div class="form-group">
                    <input type="text" name="Reg_Email" id="Reg_Email" class="form-control input-lg" placeholder="Email" tabindex="3" data-bvalidator="email,required" data-bvalidator-msg="Email">
                </div>
                <div class="form-group">
                    <input type="password" name="NewUser_Password" id="NewUser_Password" class="form-control input-lg" placeholder="Password" tabindex="4" data-bvalidator="minlength[6],required">
                </div>
                <div class="form-group">
                    <input type="password" name="password_confirmation" id="password_confirmation" class="form-control input-lg" placeholder="Confirm Password" tabindex="5" data-bvalidator="equalto[NewUser_Password],required" data-bvalidator-msg="Confirm Password">
                </div>
                <div class="form-group">
                    @{ MvcCaptcha sampleCaptcha = new MvcCaptcha("SampleCaptcha"); }
                    @Html.Captcha(sampleCaptcha)
                </div>
                <div class="form-group">
                    @Html.TextBox("CaptchaCode", null, new { @class = "form-control input-lg", placeholder = "Please enter above code" })
                    @Html.ValidationMessage("CaptchaCode")
                </div>
                <hr class="colorgraph">
                <div class="row">
                    <input type="submit" class="btn btn-primary btn-lg btn-block" value="Register" tabindex="6">
                </div>
            }

My page on the browser will be

enter image description here

Please help me

1 Answer 1

2

You might try:

 @Html.TextBox("CaptchaCode", null, new  { required = "required" }, { @class = "form-control input-lg", placeholder = "Please enter above code" })      
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.