How to Auto-Increment a Numeric Field for Multiple Submissions within Same Browser Session?

How to Auto-Increment a Numeric Field for Multiple Submissions within Same Browser Session?

I've got a form that asks users to supply a set of data.  They may submit one or more datasets per browser session.  One field is a date field.  Another field is a numeric field that should be "1" for the first dataset submitted for a specific date, "2" for the second dataset with the same date, "3" for the third dataset with the same date, etc.  

They can also enter a different date, for which the numeric field should reset to "1" and increment by 1 for each subsequent dataset submission for the new date.

Is there a way to get the numeric field to automatically increment by 1 if the date is the same and reset to 1 if / when the date changes (within the same browser session)?

Also, is there a way to alert / prevent the user from entering another dataset with the same date / numeric field value?

Thanks!