Welcome Guest, Not a member yet? Register   Sign In
Validated & Non Validated Form Fields
#1

[eluser]Unknown[/eluser]
Hey Guys,

I have a question for you. I have a form where some fields require validation, and some do not. Since I only have some fields that need to be validated, I only have those ones in my validation rules:
Code:
$this->form_validation->set_rules('name', 'Name', 'required');
$this->form_validation->set_rules('email', 'Email Address', 'required|valid_email');
$this->form_validation->set_rules('message', 'Message', 'required');
There are two additional fields that are in the form, which are "company" and "website". I was using "set_value()" to return the value's to my fields in my view file, but for my "company" and "website" fields, they were not showing their value - obviously because I am not declaring them in my validation rules (because they don't need to be validated). What I am doing instead is using the post array through the input class to return values to all my fields.

My question is this: what is the best way to handle forms where I have required and non required fields. Should I add the non required fields into the form validation class, and just specify no rules so I can use the "set_value()" function, or should I set the values for all form fields in the view using the post array.

Thanks,
~Nicholas


Messages In This Thread
Validated & Non Validated Form Fields - by El Forum - 12-21-2008, 09:13 PM
Validated & Non Validated Form Fields - by El Forum - 12-21-2008, 09:42 PM
Validated & Non Validated Form Fields - by El Forum - 12-22-2008, 03:12 AM
Validated & Non Validated Form Fields - by El Forum - 12-22-2008, 10:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB