Welcome Guest, Not a member yet? Register   Sign In
Validation library/Helper form
#1

[eluser]Mat-Moo[/eluser]
I'm trying to do a contact form, and learning as I go Smile But I've hit a small issue :-

Code:
$rules['fname'] = "trim|required|min_length[5]|max_length[48]|xss_clean";
$rules['femail'] = "trim|required|valid_email";
$rules['fcomments'] = "trim|required|min_length[16]|max_length[1024]|xss_clean";

$this->validation->set_error_delimiters('<li>', '</li>');
$this->validation->set_rules($rules);

# set data
$data["fname"] = "Name";
$data["femail"] = "E-mail address";
$data["fcomments"] = "Comments";
$this->validation->set_fields($data);

$data["fname"] = array('name' => 'fname', 'id' => 'fname', 'class' => ($this->validation->fname_error<>"") ? 'textbox error' : 'textbox', 'value' => $this->validation->fname);
$data["femail"] = array('name' => 'femail', 'id' => 'femail', 'class' => 'textbox', 'value' => $this->validation->femail);
$data["fcomments"]=array('name' => 'fcomments', 'rows' => 5, 'cols' => 80, 'value' => $this->validation->fcomments);

As you can see in $data[fname] I'm trying to set the class of the box depending on the bases of the validation (textbox) or (textbox error). But I can't work out how you validate, or check the validation of a single field? I'm doing it this way as my form uses the form_input($fname) rather than a basic html form.

Clues and inputs aer welcome Smile


Messages In This Thread
Validation library/Helper form - by El Forum - 10-20-2008, 02:30 PM
Validation library/Helper form - by El Forum - 10-20-2008, 03:32 PM
Validation library/Helper form - by El Forum - 10-20-2008, 03:40 PM
Validation library/Helper form - by El Forum - 10-20-2008, 04:47 PM
Validation library/Helper form - by El Forum - 10-20-2008, 04:51 PM
Validation library/Helper form - by El Forum - 10-20-2008, 04:57 PM
Validation library/Helper form - by El Forum - 10-21-2008, 02:21 AM



Theme © iAndrew 2016 - Forum software by © MyBB