I have these two radio buttons that require the user to select one of the two radio buttons. I have been trying to figure out how to style the radio buttons to look more like regular buttons. How can i style these radio buttons to look like normal buttons but keep the radio button behavior and the form validation as well?
Also I am using bootstrap for most of my styling in case that was not clear.
// Example starter JavaScript for disabling form submissions if there are invalid fields
(function() {
'use strict';
window.addEventListener('load', function() {
// Fetch all the forms we want to apply custom Bootstrap validation styles to
var forms = document.getElementsByClassName('needs-validation');
// Loop over them and prevent submission
var validation = Array.prototype.filter.call(forms, function(form) {
form.addEventListener('submit', function(event) {
if (form.checkValidity() === false) {
event.preventDefault();
event.stopPropagation();
}
form.classList.add('was-validated');
}, false);
});
}, false);
})();
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
</head>
<form class="needs-validation" novalidate>
<div class="form-group">
<div class="form-check">
<input class="form-check-input" type="radio" name="choice" id="emailConsentRadio" value="save" required>
<label class="form-check-label btn btn-outline-primary" for="save">
save
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="choice" id="emailConsentRadio" value="cancel" required>
<label class="form-check-label btn btn-outline-danger" for="cancel">
cancel
</label>
<div class="invalid-feedback">
select one option
</div>
</div>
</div>
<button type="submit" name="signup_signup" class="btn btn-primary btn-block" aria-describedby="signup_notes">Submit</button>
</form>