Validate number of items being posted ASP using Javascript

I have a ASP page with Javascript. It is a totally dynamic page, so I cannot say on how many values will get posted or submitted. But I am sure that the first field will be Request Number and the last field will be the Submit button, in between there should be multiple of 3 fields to be posted. So if the user is making one entry, the field count should be Request Number + 3 fields + Submit Button, total of 5 values to be submitted. In between the multiple of 3 can be any.

I need to validate this before the data is posted after pressing the Submit Button. If for example, the number of fields is less than 5 , it should not post and give error, etc,etc…

Valid number of fields will be minimum 5 or 8 or 11 or 14 or 17 or 20 or 23 or 26 or 29, etc,etc….

Kindly help me with a Javascript function.

Thanks in advance.

Source: forms

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.