I need to be able to set a counter to monitor how many errors have been generated when a form is submitted. Errors are highlighted by a css class .validmissing.
So if user has 5 errors on submit - counter is set to 1
If user resubmits the form and then gets 3 errors my counter needs increment to 2 in the same session.
<script type="text/javascript">
var ErrorCounter = 0;
$(document).ready(function() {
if($('.validmissing').length > 0) {
ErrorCounter = 1;
else{
ErrorCounter = 0;
}
});
</script>
Do i need to set a cookie or a session variable?