I have multiple <input type="text" name="userID"> on client side, but I have no idea how many it will be before it submits (as user can dynamically click on "add"/"remove" any of the rows).
Question and problem
1. I need to do some clientside validation before submit back to server. Therefore I need to know how many userIDs were created. and the problem is when only ONE userID, it will be as text format; if MORE THAN ONE userID created, it will become an array format. Without knowing the numbers of userID, I cannot determine I should loop UserID as in array for validation or just get the UserID as in single text.
Please advice, thank you.
p/s: currently I put a hidden field as <input type="hidden" name="counter" value="1">
whenever user click on Add, it will +1, whenever user click on Delete, it will -1. I think this way is pretty stupid, and I hope this is not the way and the only way of doing it.