Match two string fields?

3 views
Skip to first unread message

robinne

unread,
Oct 19, 2011, 10:49:18 PM10/19/11
to inputex
I thought I would be able to use the "confirm" attribute that is used
for password fields to verify that 2 string fields match, but that
apparently does not work for string fields. Any suggestions on how to
require 2 email fields to match? I could do just plain javascript, but
I don't know how to call the JavaScript before the form submit. Can I
use regex on the second email field and validate that it is the same
as first email field? What is the regex syntax for something like
that. Thanks.


var SignUpForm = new inputEx.Form({
parentEl: 'inputExFormSignUp',
fields: [
{
"type" : "string",
"label" : "First Name",
"name" : "firstname",
required:"required",
showMsg: true,
"value" : "",
},
{
"type" : "string",
"label" : "Last Name",
"name" : "lastname",
required:"required",
showMsg: true,
"value" : "",
},
{
"type" : "email",
"label" : "Email",
"name" : "email",
required:"required",
showMsg: true,
"value" : "",
},
{
"type" : "email",
"label" : "Re-enter Email",
"name" : "email2",
required:"required",
showMsg: true,
"value" : "",
},
{
"type" : "password",
"label" : "Password",
"name" : "password",
id:"PWD",
required:"required",
showMsg: true,
"value" : ""
},
{
"type" : "password",
"label" : "Re-enter Password",
"name" : "password2",
confirm: "PWD",
showMsg: true,
required:"required",
"value" : ""
}
],
buttons: [{type: 'submit', value: 'Create Account'}],
ajax:{method: 'POST',
uri: '/SignUp',
callback:{
success:function(o) {},
failure:function(o) {}
}
}});
Reply all
Reply to author
Forward
0 new messages