I have multiple checkbox groups being checked for validity on change. All code was triple checked in preview and live and shows that it’s working. However, in preview, the checkboxes will turn red if both boxes are checked but in live, nothing happens except for a yellow border. How can I get the error coloring to indicate in live?
Here’s an example of the code used on the checkboxes with “yes/no”:
Thanks for your reply - can you give me an example that would show how to use it for the purposes I’m trying to do? I cannot seem to wrap my head around how to write this at all.
If I can’t use the validity (it’s worked on other checkbox groups) I’ve tried changing the style but that also always errors out
@ahmadnasriya I guess I was overthinking it. However, I’m still at the same crossroads. On the live site, no errors show when both boxes are checked (the checkboxes don’t turn red like they should - and like they do on preview). The red DOES show up when both boxes are not checked like it should.
value.length > 1 ? reject('Only one staff allowed!') : null;
@raraavismedia , as Ahmad said, you can’t use the validity.valid to set the validty. So either use Ahmad’s code with the ternary operator (after you fix the typo). Or make it an explicit condition: