Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
im using jquery.validate.min.js
HTML
<script>
        $(document).ready(function () {

            $("#form1").validate({               
                onsubmit: false,
                validClass: "has-success"
            });

            $('.validationGroup .causesValidation').click(Validate);
        });

        function Validate(evt) {
            var $group = $(this).parents('.validationGroup');
            var isValid = true;
            $group.find(':input').each(function (i, item) {
                if (!$(item).valid()) {
                    $(this).closest('.validationGroup').addClass('has-error');
                    isValid = false;
                }
            });

            if (!isValid) evt.preventDefault();
        }
    </script>


the code is working until i add the radiobutton code into the form
XML
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-default active">
<input type="radio" value="M" />Male
</label>
<label class="btn btn-default">
<input type="radio" value="F" />Female
</label>
</div>

now, whenever i click the submit button, the form call a postback, which it shouldn't. it suppose to check for the validation first then only call a post back. any idea where is the error?
Posted
Updated 29-Jun-14 20:19pm
v2
Comments
[no name] 30-Jun-14 2:16am    
which type of validation did you put? can you bit clear to us
melvintcs 30-Jun-14 2:20am    
sorry, forget to mentions, it's jquery.validate.min.js

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900