CodeIgniter Forums
set_value i think - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: set_value i think (/showthread.php?tid=28011)



set_value i think - El Forum - 02-27-2010

[eluser]Funky Fresh[/eluser]
Hey All,

In my view i have the following code.

Code:
$listname = array(
    'name'    => 'listname',
    'id'    => 'listname',
    'value'    =>    set_value('listname'),
    'maxlength'    => 255,
    'size'    => 60,
);
$fromname = array(
    'name'    => 'fromname',
    'id'    => 'fromname',
    'value'    => set_value('fromname'),
    'maxlength'    => 255,
    'size'    => 60,
);

Then below i have the following

Code:
<td>&lt;?php echo form_input($listname); ?&gt;</td>
<td>&lt;?php echo form_input($fromname); ?&gt;</td>

When i hit submit i have other fields in the form that need validation, but i dont want these to have any, so how do i get them to return the values to the fields when one of the other fields has errors?

Do i still have to add the form_validation stuff in the controller?

just without any actual values like so

Code:
$this->form_validation->set_rules('fromname', 'From Name');

Cheers,


set_value i think - El Forum - 03-02-2010

[eluser]farinspace[/eluser]
I usually do the following:

Code:
$this->form_validation->set_rules('fromname', 'From Name','optional');

CI ignores the "optional" rule (or any other rule it doesn't recognize) ...