Skip to content

Instantly share code, notes, and snippets.

@neilbradley
Created August 10, 2009 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save neilbradley/165167 to your computer and use it in GitHub Desktop.
Save neilbradley/165167 to your computer and use it in GitHub Desktop.
// create our form
var myForm = new glow.forms.Form("#fmcustomer")
var myForm = glow.lang.trim("txtCompany","txtForename","txtSurname2)
// add tests for First Name
.addTests(
"txtCompany",
["required", {
on: "change submit",
message: "Please tell us your company name"
}]
)
.addTests(
"txtForename",
["required", {
on: "change submit",
message: "Please tell us your first name"
}],
["regex", {
on: "idle change submit",
arg: /^[A-Za-z]+$/,
message: "Your first name can only contain letters"
}]
)
.addTests(
"txtSurname",
["required", {
on: "change submit",
message: "Please tell us your last name"
}],
["regex", {
on: "idle change submit",
arg: /^[A-Za-z]+$/,
message: "Your last name can only contain letters"
}]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment