added more validation
This commit is contained in:
parent
d33d3d6d6b
commit
7878ff6082
6 changed files with 184 additions and 55 deletions
|
@ -21,6 +21,31 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
|
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
|
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
|
||||||
|
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
|
||||||
|
<script src="bootstrap/js/bootstrap.min.js"></script>
|
||||||
|
<script src="js/jquery.validate.min.js"></script>
|
||||||
|
<script src="js/giftreg.js"></script>
|
||||||
|
|
||||||
|
<script language="JavaScript" type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#categoryform").validate({
|
||||||
|
highlight: validate_highlight,
|
||||||
|
success: validate_success,
|
||||||
|
rules: {
|
||||||
|
category: {
|
||||||
|
required: true,
|
||||||
|
maxlength: 50
|
||||||
|
}
|
||||||
|
},
|
||||||
|
messages: {
|
||||||
|
category: {
|
||||||
|
required: "Category name is required.",
|
||||||
|
maxlength: "Category name must be 50 characters or less."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{include file='navbar.tpl' isadmin=$isadmin}
|
{include file='navbar.tpl' isadmin=$isadmin}
|
||||||
|
@ -79,7 +104,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
<a name="catform">
|
<a name="catform">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span12">
|
<div class="span12">
|
||||||
<form name="category" method="get" action="categories.php" class="well form-horizontal">
|
<form name="categoryform" id="categoryform" method="get" action="categories.php" class="well form-horizontal">
|
||||||
{if $action == "edit" || (isset($haserror) && $action == "update")}
|
{if $action == "edit" || (isset($haserror) && $action == "update")}
|
||||||
<input type="hidden" name="categoryid" value="{$categoryid}">
|
<input type="hidden" name="categoryid" value="{$categoryid}">
|
||||||
<input type="hidden" name="action" value="update">
|
<input type="hidden" name="action" value="update">
|
||||||
|
@ -106,8 +131,5 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
|
|
||||||
<script src="bootstrap/js/bootstrap.min.js"></script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -21,18 +21,28 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
|
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
|
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
|
||||||
|
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
|
||||||
|
<script src="bootstrap/js/bootstrap.min.js"></script>
|
||||||
|
<script src="js/jquery.validate.min.js"></script>
|
||||||
|
<script src="js/giftreg.js"></script>
|
||||||
|
|
||||||
<script language="JavaScript" type="text/javascript">
|
<script language="JavaScript" type="text/javascript">
|
||||||
function validate() {
|
$(document).ready(function() {
|
||||||
field = document.forgot.username;
|
$("#forgotform").validate({
|
||||||
if (field == null || field == undefined || !field.value.match("\\S")) {
|
highlight: validate_highlight,
|
||||||
alert("You must supply a username.");
|
success: validate_success,
|
||||||
field.focus();
|
rules: {
|
||||||
return false;
|
username: {
|
||||||
}
|
required: true
|
||||||
|
},
|
||||||
return true;
|
},
|
||||||
}
|
messages: {
|
||||||
|
username: {
|
||||||
|
required: "Username is required."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -50,7 +60,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
{else}
|
{else}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span12">
|
<div class="span12">
|
||||||
<form name="forgot" method="post" action="forgot.php" class="well form-horizontal">
|
<form name="forgotform" id="forgotform" method="post" action="forgot.php" class="well form-horizontal">
|
||||||
<input type="hidden" name="action" value="forgot">
|
<input type="hidden" name="action" value="forgot">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Reset Your Password</legend>
|
<legend>Reset Your Password</legend>
|
||||||
|
@ -68,7 +78,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<button type="submit" class="btn btn-primary" onClick="return validate();">Submit</button>
|
<button type="submit" class="btn btn-primary">Submit</button>
|
||||||
<button type="button" class="btn" onClick="document.location.href='login.php';">Cancel</button>
|
<button type="button" class="btn" onClick="document.location.href='login.php';">Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
@ -77,8 +87,5 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
|
|
||||||
<script src="bootstrap/js/bootstrap.min.js"></script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -22,29 +22,66 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
|
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
|
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
|
||||||
|
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
|
||||||
|
<script src="bootstrap/js/bootstrap.min.js"></script>
|
||||||
|
<script src="js/jquery.validate.min.js"></script>
|
||||||
|
<script src="js/giftreg.js"></script>
|
||||||
|
|
||||||
<script language="JavaScript" type="text/javascript">
|
<script language="JavaScript" type="text/javascript">
|
||||||
function confirmPassword() {
|
$(document).ready(function() {
|
||||||
var theForm = document.forms["changepwd"];
|
$("#changepwdform").validate({
|
||||||
if (theForm.newpwd.value != theForm.confpwd.value) {
|
highlight: validate_highlight,
|
||||||
alert("Passwords don't match.");
|
success: validate_success,
|
||||||
return false;
|
rules: {
|
||||||
}
|
newpwd: {
|
||||||
return true;
|
required: true,
|
||||||
}
|
maxlength: 50
|
||||||
function validateProfile() {
|
},
|
||||||
var theForm = document.forms["profile"];
|
confpwd: {
|
||||||
if (!theForm.fullname.value.match("\\S")) {
|
required: true,
|
||||||
alert("A full name is required.");
|
maxlength: 50,
|
||||||
theForm.fullname.focus();
|
equalTo: "#newpwd"
|
||||||
return false;
|
}
|
||||||
}
|
},
|
||||||
if (!theForm.email.value.match("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*")) {
|
messages: {
|
||||||
alert("The e-mail address '" + theForm.email.value + "' is not a valid address.");
|
newpwd: {
|
||||||
theForm.email.focus();
|
required: "Password is required.",
|
||||||
return false;
|
maxlength: "Password must be 50 characters or less."
|
||||||
}
|
},
|
||||||
return true;
|
confpwd: {
|
||||||
}
|
required: "Confirmation is required.",
|
||||||
|
maxlength: "Confirmation must be 50 characters or less.",
|
||||||
|
equalTo: "Passwords don't match."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$("#profileform").validate({
|
||||||
|
highlight: validate_highlight,
|
||||||
|
success: validate_success,
|
||||||
|
rules: {
|
||||||
|
fullname: {
|
||||||
|
required: true,
|
||||||
|
maxlength: 50
|
||||||
|
},
|
||||||
|
email: {
|
||||||
|
required: true,
|
||||||
|
maxlength: 255,
|
||||||
|
email: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
messages: {
|
||||||
|
fullname: {
|
||||||
|
required: "Full name is required.",
|
||||||
|
maxlength: "Full name must be 50 characters or less."
|
||||||
|
},
|
||||||
|
email: {
|
||||||
|
required: "E-mail address is required.",
|
||||||
|
maxlength: "E-mail address must be 255 characters or less.",
|
||||||
|
email: "E-mail address must be a valid address."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -53,7 +90,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
<div class="container" style="padding-top: 60px;">
|
<div class="container" style="padding-top: 60px;">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span8 offset2">
|
<div class="span8 offset2">
|
||||||
<form name="changepwd" action="profile.php" method="POST" onSubmit="return confirmPassword();" class="well form-horizontal">
|
<form name="changepwdform" id="changepwdform" action="profile.php" method="POST" class="well form-horizontal">
|
||||||
<input type="hidden" name="action" value="changepwd">
|
<input type="hidden" name="action" value="changepwd">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Change Password</legend>
|
<legend>Change Password</legend>
|
||||||
|
@ -79,20 +116,20 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span8 offset2">
|
<div class="span8 offset2">
|
||||||
<form name="profile" action="profile.php" method="POST" onSubmit="return validateProfile();" class="well form-horizontal">
|
<form name="profileform" id="profileform" action="profile.php" method="POST" class="well form-horizontal">
|
||||||
<input type="hidden" name="action" value="save">
|
<input type="hidden" name="action" value="save">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Update Profile</legend>
|
<legend>Update Profile</legend>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label" for="fullname">Full name</label>
|
<label class="control-label" for="fullname">Full name</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input type="text" id="fullname" name="fullname" class="input-xlarge" value="{$fullname}">
|
<input type="text" id="fullname" name="fullname" class="input-xlarge" value="{$fullname|escape:'htmlall'}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label" for="email">E-mail address</label>
|
<label class="control-label" for="email">E-mail address</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input type="text" id="email" name="email" class="input-xlarge" value="{$email}">
|
<input type="text" id="email" name="email" class="input-xlarge" value="{$email|escape:'htmlall'}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
|
@ -105,7 +142,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label" for="comment">Comments / shipping address / etc. (optional)</label>
|
<label class="control-label" for="comment">Comments / shipping address / etc. (optional)</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<textarea id="comment" name="comment" rows="5" cols="40">{$comment}</textarea>
|
<textarea id="comment" name="comment" rows="5" cols="40">{$comment|escape:'htmlall'}</textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
|
@ -117,7 +154,5 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
|
|
||||||
<script src="bootstrap/js/bootstrap.min.js"></script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -21,6 +21,39 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
|
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
|
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
|
||||||
|
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
|
||||||
|
<script src="bootstrap/js/bootstrap.min.js"></script>
|
||||||
|
<script src="js/jquery.validate.min.js"></script>
|
||||||
|
<script src="js/giftreg.js"></script>
|
||||||
|
|
||||||
|
<script language="JavaScript" type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#theform").validate({
|
||||||
|
highlight: validate_highlight,
|
||||||
|
success: validate_success,
|
||||||
|
rules: {
|
||||||
|
title: {
|
||||||
|
required: true,
|
||||||
|
maxlength: 50
|
||||||
|
},
|
||||||
|
rendered: {
|
||||||
|
required: true,
|
||||||
|
maxlength: 255
|
||||||
|
}
|
||||||
|
},
|
||||||
|
messages: {
|
||||||
|
title: {
|
||||||
|
required: "A title is required.",
|
||||||
|
maxlength: "Title must be 50 characters or less."
|
||||||
|
},
|
||||||
|
rendered: {
|
||||||
|
required: "HTML is required.",
|
||||||
|
maxlength: "HTML must be 255 characters or less."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{include file='navbar.tpl' isadmin=$isadmin}
|
{include file='navbar.tpl' isadmin=$isadmin}
|
||||||
|
@ -71,7 +104,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
<a name="rankform">
|
<a name="rankform">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span12">
|
<div class="span12">
|
||||||
<form name="rank" method="get" action="ranks.php" class="well form-horizontal">
|
<form name="theform" id="theform" method="get" action="ranks.php" class="well form-horizontal">
|
||||||
{if $action == "edit" || (isset($haserror) && $action == "update")}
|
{if $action == "edit" || (isset($haserror) && $action == "update")}
|
||||||
<input type="hidden" name="ranking" value="{$ranking}">
|
<input type="hidden" name="ranking" value="{$ranking}">
|
||||||
<input type="hidden" name="action" value="update">
|
<input type="hidden" name="action" value="update">
|
||||||
|
@ -107,8 +140,5 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
|
|
||||||
<script src="bootstrap/js/bootstrap.min.js"></script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
{* Smarty *}
|
|
||||||
Hello {$name}, welcome to Smarty!
|
|
|
@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
|
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
|
||||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
|
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
|
||||||
<script src="bootstrap/js/bootstrap.min.js"></script>
|
<script src="bootstrap/js/bootstrap.min.js"></script>
|
||||||
|
<script src="js/jquery.validate.min.js"></script>
|
||||||
|
<script src="js/giftreg.js"></script>
|
||||||
|
|
||||||
<script language="JavaScript" type="text/javascript">
|
<script language="JavaScript" type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
@ -32,6 +34,41 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#theform").validate({
|
||||||
|
highlight: validate_highlight,
|
||||||
|
success: validate_success,
|
||||||
|
rules: {
|
||||||
|
username: {
|
||||||
|
required: true,
|
||||||
|
maxlength: 20
|
||||||
|
},
|
||||||
|
fullname: {
|
||||||
|
required: true,
|
||||||
|
maxlength: 50
|
||||||
|
},
|
||||||
|
email: {
|
||||||
|
required: true,
|
||||||
|
maxlength: 255,
|
||||||
|
email: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
messages: {
|
||||||
|
username: {
|
||||||
|
required: "Username is required.",
|
||||||
|
maxlength: "Username must be 20 characters or less."
|
||||||
|
},
|
||||||
|
fullname: {
|
||||||
|
required: "Full name is required.",
|
||||||
|
maxlength: "Full name must be 50 characters or less."
|
||||||
|
},
|
||||||
|
email: {
|
||||||
|
required: "E-mail address is required.",
|
||||||
|
maxlength: "E-mail address must be 255 characters or less.",
|
||||||
|
email: "E-mail address must be a valid address."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
@ -93,7 +130,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
<a name="userform">
|
<a name="userform">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span12">
|
<div class="span12">
|
||||||
<form name="users" method="get" action="users.php" class="well form-horizontal">
|
<form name="theform" id="theform" method="get" action="users.php" class="well form-horizontal">
|
||||||
{if $action == "edit" || (isset($haserror) && $action == "update")}
|
{if $action == "edit" || (isset($haserror) && $action == "update")}
|
||||||
<input type="hidden" name="userid" value="{$userid}">
|
<input type="hidden" name="userid" value="{$userid}">
|
||||||
<input type="hidden" name="action" value="update">
|
<input type="hidden" name="action" value="update">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue