View Full Version : smartyValidate

Chris Hick
07-29-2012, 06:00 AM
Okay, so I have started using the smarty validate class for validating forms for a website that uses the smarty template engine. It says on the smarty validate page that one can use multiple validations for a single field. But I have tried this but to know avail. Has anyone else come across this?? Any solutions??

Here is two snippets of my code:

SmartyValidate::register_validator('pWordEqual','password:password2','isEqual','false','false','trim ');

<form class="form" action="signup.php" method="POST">
<p class="username">
{validate id="userEmpty" message="Username cannot be empty"}
{validate id="userLength" message="Username must be a minimum of 6 characters and a max of 32 characters."}
<input type="text" name="username" id="username" />
<label for="username">Username</label>
<p class="password">
{validate id="pWord" message="Password cannot be empty"}
<input type="password" name="password" id="password" />
<label for="password">Password</label>
<p class="password">
{validate id="pWord2" message="Password cannot be empty"}
{validate id="pWordEqual" message="Both password fields must be equal."};
<input type="password" name="password2" id="password2" />
<label for="password2">Password(Retype)</label>
<p class="email">
{validate id="emailEmpty" message="Email cannot be empty"}
{validate id="emailEmpty" message="Please enter a valid email"}
<input type="text" name="email" id="email" />
<label for="email">E-mail</label>
<p class="submit">
<input type="submit" value="Sign Up" name="signup" />

07-29-2012, 07:36 PM
Try removing the apostrophes from the words 'true' and 'false'.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum