Skip to content

Instantly share code, notes, and snippets.

@kevzettler
Created March 25, 2012 19:00
Show Gist options
  • Save kevzettler/2199046 to your computer and use it in GitHub Desktop.
Save kevzettler/2199046 to your computer and use it in GitHub Desktop.
default validation
<form action="/" method="post" id="form" class="validate[required,funcCall[checkDefault]]">
<input type="submit" value="submit" />
</form>
<script type="text/javascript">
/*
* Awesome helper function for validationEngine
* great for use with autobox
* checkes that a field is not the default value before submitting
*/
function checkDefault(field, rules, i, options){
if(field.get(0).defaultValue == field.val()){
return "* Field is required";
}
}
$(doucment).ready(function(){
$('#form').validationEngine('attach', {
onValidationComplete: function(form, status){
if(status === true){
$('#form').submit();
}
}
,promptPosition: "topLeft"
,scroll: false
});
});
</script>
Copy link

ghost commented Mar 27, 2012

$(doucement) 8-D field.val() ? field.defaultVal() (extend field) -> placeholder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment