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;
- radioAddress1: { require_from_group: [1, ".customer_address"] },
- 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:
- <?php
- $savanna_mysql_query = $savanna_mysql_connection->prepare('CALL sp_web_populate_customer_addresses(:param_customer)');
- $savanna_mysql_query->bindParam(':param_customer', $_SESSION["customer_id"], PDO::PARAM_STR);
-
- $savanna_mysql_query->execute();
- while($savanna_mysql_row = $savanna_mysql_query->fetch())
- {
- ?>
-
- <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>
- <?php } ?>
- <input class="customer_address" type="radio" id="radioAddressOther" name="radioAddress" value="OTHER" required><label for="radioAddressOther">Other Address</label>
Thanks,