Skip to content

Instantly share code, notes, and snippets.

@jakearchibald
Created August 10, 2009 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakearchibald/165192 to your computer and use it in GitHub Desktop.
Save jakearchibald/165192 to your computer and use it in GitHub Desktop.
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