Dynamic jQuery Validation

Dynamic jQuery Validation

Hi,
I am using below code to populate the customer address from the database and assinging the ID from the database so it will be unique  id="radioAddress<?php echo $savanna_mysql_row["customer_address_id"]; ?>"

Now I want to a validation rule using jquery validation like this;

  1. radioAddress1: { require_from_group: [1, ".customer_address"] },
  2. radioAddress2: { require_from_group: [1, ".customer_address"] },

Knowing that there is no fixed number of addresses for the customer and it can be from Zero to any number.

How can I do this please?

here is my code:


  1. <?php
  2. $savanna_mysql_query = $savanna_mysql_connection->prepare('CALL sp_web_populate_customer_addresses(:param_customer)');
  3. $savanna_mysql_query->bindParam(':param_customer', $_SESSION["customer_id"], PDO::PARAM_STR);
  4. $savanna_mysql_query->execute();

  5. while($savanna_mysql_row = $savanna_mysql_query->fetch())
  6. {
  7. ?>
  8. <input class="customer_address" type="radio" id="radioAddress<?php echo $savanna_mysql_row["customer_address_id"]; ?>" name="radioAddress" value="<?php echo $savanna_mysql_row["customer_address_id"]; ?>" required><label for="radioAddress<?php echo $savanna_mysql_row["customer_address_id"]; ?>"><?php echo $savanna_mysql_row["address_category_name"]; ?></label>

  9. <?php } ?>

  10. <input class="customer_address" type="radio" id="radioAddressOther" name="radioAddress" value="OTHER"  required><label for="radioAddressOther">Other Address</label>

Thanks,