Hi,
Using jQuery, I'm trying to validate and make sure one of the radio buttons for each group is selected. For example, there are 2 radio buttons each with group name="DeliveryMethod", 2 radio buttons each with name="LiftGate", 2 radio buttons each with name="InsideDelivery", and so on. Please see code below.
On load of the page, none of the radio buttons is selected by default. On click fo submit button, I'd like to pop an alert stating "Please answer all questions!" if at least one of the questions is not answered/selected.
Is it possible to loop thru all radio type fields instead of relying on the unique id of each radio field in the code? Please provide a sample user defined function that does that.
Many thanks in advance.
<label for="DeliveryMethod1"><inp
ut type="radio" name="DeliveryMethod" id="DeliveryMethod1" value="0"> <strong>UPS Ground</strong></label><br
>
<label for="DeliveryMethod2"><inp
ut type="radio" name="DeliveryMethod" id="DeliveryMethod2" value="1"> <strong>FedEx Ground</strong></label><br
><br>
<strong>Is lift gate service required?</strong>
<label for="LiftGate1"><input type="radio" name="LiftGate" id="LiftGate1" value="1"> Yes</label> &nb
sp;<label for="LiftGate2"><input type="radio" name="LiftGate" id="LiftGate2" value="0"> No</label><br><br>
<strong>Is inside delivery required?</strong>
<label for="InsideDelivery1"><inp
ut type="radio" name="InsideDelivery" id="InsideDelivery1" value="1"> Yes</label> &nb
sp;<label for="InsideDelivery2"><inp
ut type="radio" name="InsideDelivery" id="InsideDelivery2" value="0"> No</label><br><br>
<strong>Do you have a fork lift, or dock high door for unloading trucks?</strong>
<label for="FortLift1"><input type="radio" name="FortLift" id="FortLift1" value="1"> Yes</label> &nb
sp;<label for="FortLift2"><input type="radio" name="FortLift" id="FortLift2" value="0"> No</label>