Skip to content

Instantly share code, notes, and snippets.

@gmcinnes
Created June 13, 2012 23:08
Show Gist options
  • Select an option

  • Save gmcinnes/2927071 to your computer and use it in GitHub Desktop.

Select an option

Save gmcinnes/2927071 to your computer and use it in GitHub Desktop.
Incomplete Validation
function handleOnSubmit() {
var formObject = document.getElementById('discovery-document');
if (submitted) {
alert('Form has already been submitted. Please wait for a response.');
return false;
} else {
var errors = false;
var message = 'The form cannot be submitted until the following errors are corrected:n';
var practiceSelection = document.getElementById('00N50000002PT2j');
if (practiceSelection.selectedIndex == 0) {
message += 'Sector is a required field.n';
errors = true;
practiceSelection.focus();
}
if (errors) {
alert(message);
return false;
} else {
submitted = true;
// alert('Submitting'); formObject.submit();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment