[Solved] How to validate form when only one out of two required fields is filled in [closed]


Are you simply asking how to validate a set of radio buttons? Since you’ve shown no code, all I can show you is how you would validate a set of radio input‘s with the plugin.

Then you would dynamically add/remove rules from the corresponding inputs using the built-in rules method. Again, I’d need to see your code before customizing a solution.

Working Demo: http://jsfiddle.net/PbHwX/

jQuery:

$(document).ready(function () {

    $('#myform').validate({
        rules: {
            radiotest: {
                required: true
            }
        },
        messages: {
            radiotest: {
                required: "please select at least one option"
            }
        }
    });

});

HTML:

<input type="radio" name="radiotest" value="0" />
<input type="radio" name="radiotest" value="1" />

Documentation: http://docs.jquery.com/Plugins/Validation

solved How to validate form when only one out of two required fields is filled in [closed]