[eluser]Dr. Seuss[/eluser]
Greetings.
Using reCAPTCHA 2 and I have the "basic" code working great. My question is: How do I add additonal form validation rules to the "rules" array that is in the reCAPTCHA 2 sample code?
My code--which doe not work--looks like:
Code:
$rules = array(
array(
"field" => "recaptcha_challenge_field",
"label" => "reCAPTCHA Label",
"rules" => "required|recaptcha_matches"
)
);
$rules['username'] = "trim|required|min_length[5]|max_length[50]|xss_clean";
$rules['pwd'] = "trim|required|matches[confpwd]";
$rules['confpwd'] = "trim|required";
$rules['email'] = "trim|required|valid_email";
$this->form_validation->set_rules($rules);
// Do validation run
if ($this->form_validation->run() == FALSE)
The additional fields that I am trying to add rules for is obviously in the section:
Code:
$rules['username'] = "trim|required|min_length[5]|max_length[50]|xss_clean";
$rules['pwd'] = "trim|required|matches[confpwd]";
$rules['confpwd'] = "trim|required";
$rules['email'] = "trim|required|valid_email";
...but that does not work--the form validates even when I submit with these fields totally empty.
The form code looks like this:
Code:
<b>Create Account </b>
<form action="../../auth" method="post">
<table>
<tr>
<td>User Name:</td>
<td><input size=100></td>
</tr>
<tr>
<td>Email:</td>
<td><input size=100></td>
</tr>
<tr>
<td>Password:</td>
<td><input size=50></td>
</tr>
<tr>
<td>Verify Password:</td>
<td><input size=15></td>
</tr>
<tr>
<td colspan=2 align='center'>[removed][removed]
<noscript>
<iframe src="http://api.recaptcha.net/noscript?k=###################################" height="300" width="500" frameborder="0"></iframe><br/>
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</noscript></td>
<td></td>
</tr>
<tr>
<td colspan=2 align='center'><input type="submit" value="Go" /></td>
<td></td>
</tr>
</table>
</form>
This is my first go with the form validation class, so I am new to each stitch and if I am doing something stupid, I apologize in advance.