Skip to content

Instantly share code, notes, and snippets.

@robbl
Last active August 29, 2015 14:06
Show Gist options
  • Save robbl/996e96cb6d358d90021f to your computer and use it in GitHub Desktop.
Save robbl/996e96cb6d358d90021f to your computer and use it in GitHub Desktop.
validate_object_attribute_fields = () ->
object_attribs = $('div.active .object_select')
error = false
for select in object_attribs
id = select.id
if select.value == ""
$('div.active .evalsheet_object label[for="'+id+'"]').addClass('error-required-fields')
error = true
else
$('div.active .evalsheet_object label[for="'+id+'"]').removeClass('error-required-fields')
error = false
!error # return false if validation fails
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment