I'm trying to create a donation script for a nonprofit's website, and I want to let the donors either pick a specific donation amount or enter their own amount. I have five radio buttons with a specific amount, and a sixth radio button labeled "other", and a textarea next to it for users to enter their own amount.
I want the script to validate this way:
Either:
a.) one of the five specific amount buttons is selected or
b.) both the "other" button is selected and the textfield contains an amount
I also want it to see errors and alert the users in two different ways:
a.) If no buttons are selected, "Please select a donation amount"
b.) If the "other" button is selected and the text field is empty, "Please enter a donation amount".
One of the main problems I'm encountering is that when none of the buttons are selected, both error message are appearing.
Any help would be greatly appreciated.