CodeIgniter Forums
validation and input field has text - 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: validation and input field has text (/showthread.php?tid=8803)



validation and input field has text - El Forum - 06-01-2008

[eluser]Mitja B.[/eluser]
I have small problem and i do not know if this is possible.

i validate with CI validation. Everything ok and works, but fileds that are not required are not validate. After page is refresh validate fields still havse text in it other fields are empty. Is it possible that even this fields have text even they are not validate.

Redna: &lt;input type="text" name="price_eur" value="&lt;?= $row-&gt;price_eur?&gt;" /><br>
SiMobil: &lt;input type="text" name="price_eur_simobil" /&gt;

SiMobil field lost text after validating.

Thx, hope undesrtand me


validation and input field has text - El Forum - 06-01-2008

[eluser]Michael Wales[/eluser]
SiMobil lost it's text because you are not telling it to place any text there. Something like:

Code:
&lt;input type="text" name="price_eur_simobil" value="&lt;?= $this-&gt;validation->price_eur_simobil; ?&gt;" />

Would work, as long as you have defined that field within the set_fields() method of the Validation class. Otherwise, just do:

Code:
&lt;input type="text" name="price_eur_simobil" value="&lt;?= $this-&gt;input->post('price_eur_simobil'); ?&gt;" />