CodeIgniter Forums
form set_value() not working ,,,, - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: form set_value() not working ,,,, (/showthread.php?tid=36395)



form set_value() not working ,,,, - El Forum - 11-30-2010

[eluser]Unknown[/eluser]
Hi ,

Im new to codeigniter and this is my first post.

This is part of my code.

Code:
<td>Brand Name &lt;?=$brand_name?&gt;
        &lt;input type="text" name="txf_brand" id="txf_brand" value="&lt;?php echo set_value('txf_brand', $brand_name); ?&gt;" /&gt;&lt;/td>

Basically , i want to display the value passed from controller in a text field. Im setting the value for this ($brand_name) variable in the Controller. The correct value is displayed near "Brand Name". But not inside the set_value method. This is strange .. can anyone pls help me.

Thanks


form set_value() not working ,,,, - El Forum - 11-30-2010

[eluser]smilie[/eluser]
Hi,

set_value() is part of form validation.

If your value comes from controller, just use:
$brand_name;

Once your form has been processed and in case there are errors in the form, then you can use set_value('value_name') which will be 're-filled' on page reload.

Read the form validation in user manual.

Cheers,
Smilie


form set_value() not working ,,,, - El Forum - 11-30-2010

[eluser]Unknown[/eluser]
Hi ,

Thanks. Your first line solved the problem :o)

It worked after loading the "form_validation" library. But still i don't understand why it didn't work even though i have loaded the "form" helper.

Form Helper has "set_value()" method, right ? i read the doc.