Welcome Guest, Not a member yet? Register   Sign In
set_value not re-populating textarea after validation fails
#1

[eluser]tim1965[/eluser]
Hi Can anyone confirm if they have set_value working correctly with Textarea´s. I have a couple of very complex forms, with lots of checkboxes, menus, etc. Everything is re-populating correclty when i re-display the form if validation fails. Except my textarea fields. I have validation rules set up correctly, but they dont seem to want to work. I have duble checked everything and they should work. I will post the relevant bits of code in the hope that somewill will eyeball them for me and see if they can see what i am missing.

Controller validation rule
$this->form_validation->set_rules('contactnotes', 'Contact Notes', 'trim|required|max_length[300]|alpha_dash_space');

view
<label for="contactnotes">Your Telephone contact detials to be displayed </label>
</div>
&lt;textarea name="contactnotes" id="contactnotes" cols="50" rows="6" class="countdown limit_300_" value="&lt;?php echo set_value('contactnotes'); ?&gt;" &gt;&lt;/textarea>
<br /><span class="phperror">&lt;?php echo form_error('contactnotes'); ?&gt;</span>
<span class="remaining">&lt;!-- --&gt;</span>
There is a little bit of javascript in there as well, but i dont think that is causing the problem.
Thanks in advance.
#2

[eluser]Craig A Rodway[/eluser]
Textarea tags don't have a value attribute - the value goes between the opening and closing tags:

Code:
&lt;textarea name="contactnotes" id="contactnotes" cols="50" rows="6" class="countdown limit_300_"&gt;&lt;?php echo set_value('contactnotes'); ?&gt;&lt;/textarea&gt;
#3

[eluser]tim1965[/eluser]
Aaaaaaaaaaaaaaaaaaaargh. Its always the obvious ones. Thank you Craig.




Theme © iAndrew 2016 - Forum software by © MyBB