Welcome Guest, Not a member yet? Register   Sign In
set_value is only working for fields that have validation?
#1

[eluser]otherjohn[/eluser]
Hi all, I am using form validation on a page and for some reason only input fields that I have set form valitation rules to will auto fill. The rest are blank. Does anyone know how to fix this?
For example
if I have something like "firstname" required
Code:
$this->form_validation->set_rules('firstname', 'First Name', 'required');
and on the view have
Code:
<input id="firstname" name="firstname" type="text" class="field text" value="<?php echo set_value('firstname'); ?>" size="8" tabindex="10" />
AND
Code:
<input id="lastname" name="lastname" type="text" class="field text" value="<?php echo set_value('lastname'); ?>" size="14" tabindex="11" />

LASTNAME input doesn't auto fill but firstname does.
Validation works correctly though. Any thoughts?
#2

[eluser]Sbioko[/eluser]
Look in the source code of this library and get your answer.
#3

[eluser]Evil Wizard[/eluser]
Yes the set_value() helper method uses the CI validation object to repopulate the input values, but you can leave the rules blank, or just use trim() as the input rules and the set_value() method will work.
#4

[eluser]otherjohn[/eluser]
kk ty




Theme © iAndrew 2016 - Forum software by © MyBB