troubleshooting Question

Client side VBScript: track numbers of input fields as in <input name="userID"/>

Avatar of calvinfoo
calvinfoo asked on
Web Languages and Standards
3 Comments1 Solution960 ViewsLast Modified:

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.

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros