jbassking10 jbassking10 - 7 months ago 141
jQuery Question

Validating radio buttons with BootstrapValidator

I have a little bit of a different situation. I have 2 radio buttons, Yes and No.
The first validation needs to make sure at least one of them are checked. This part works fine.
The second part needs to make sure No was checked since No is the only valid option. If they pick Yes, it should continue to prompt them.

Normally I would use a checkbox for this but the business wants to force a Yes or No.
I thought maybe I could have added choices but that doesn't do what I need.

optionPlan: {
validators: {
notEmpty: {
message: 'Please select Yes or No'

if ($('input[name=yes]:checked').length > 0) {
    // do something here
   alert("you need to select no !");