Created
August 10, 2009 13:45
-
-
Save jakearchibald/165192 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function trimFormField(selector, on) { | |
var field = glow.dom.get(selector); | |
return ["custom", { | |
on: on, | |
arg: function(values, opts, callback, formData) { | |
field.val( glow.lang.trim(values[0]) ); | |
callback(glow.forms.PASS, ""); | |
} | |
}]; | |
} | |
// create our form | |
var myForm = new glow.forms.Form("#fmcustomer") | |
.addTests( | |
"txtCompany", | |
trimFormField("#txtCompany", "change submit"), | |
["required", { | |
on: "change submit", | |
message: "Please tell us your company name" | |
}] | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment