Welcome Guest, Not a member yet? Register   Sign In
Accessing validation field values in 1.7?
#8

[eluser]SneakyDave[/eluser]
Quote:I would have expected something like
Code:
$this->form_validation->value('name')

I was searching for a solution to a different problem, but I use this in my controllers rather than $this->input->post() just to be consistent between my views and controllers:

Code:
$this->form_validation->set_value('name')

For example in the controller for an edit function, $file is the contents retrieved from a flat file (or database).
Code:
$data['name'] = array(
       'name'        => 'name',
       'id'          => 'name',
       'value'       => $this->form_validation->set_value('name',$file->set_value('name')),
       'maxlength'   => '100',
       'size'        => '50',
                     );

The view...
Code:
...
<li><strong>Your Name:</strong><br />&lt;?=form_input($name)?&gt;<br />
&lt;?=form_error('name')?&gt;</li><br />
...

I'd like to know if there's a way to set the form POST values to something else in the controller though. I can't seem to find that without assigning the values to new variables, and changing them. For instance, I have an input field with a lastupdate date/time value. It is modifiable by the user, but if they don't modify it, I want to use the current date/time when I do a database or file update, but I can't change the value of the text input directly.


Messages In This Thread
Accessing validation field values in 1.7? - by El Forum - 10-27-2008, 11:15 AM
Accessing validation field values in 1.7? - by El Forum - 10-27-2008, 12:56 PM
Accessing validation field values in 1.7? - by El Forum - 10-27-2008, 02:29 PM
Accessing validation field values in 1.7? - by El Forum - 10-27-2008, 02:42 PM
Accessing validation field values in 1.7? - by El Forum - 10-27-2008, 02:42 PM
Accessing validation field values in 1.7? - by El Forum - 10-27-2008, 03:00 PM
Accessing validation field values in 1.7? - by El Forum - 10-27-2008, 03:19 PM
Accessing validation field values in 1.7? - by El Forum - 11-04-2008, 09:59 AM
Accessing validation field values in 1.7? - by El Forum - 11-17-2008, 10:55 AM
Accessing validation field values in 1.7? - by El Forum - 11-17-2008, 10:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB