Welcome Guest, Not a member yet? Register   Sign In
repopulating a textarea

i have a text area in my form. how do i repopulate it if validation fails. like we use
value="<?php echo $this->validation->location;?>"

for input field. but there is no "value" attribute for textarea. any idea?

With a textarea, you do
<textarea name="my_textarea">
Contents of my textarea

i dont understand
i have textarea like this
<textarea cols="16" rows="3" name="description" value="<?php echo $this->validation->description;?>"></textarea>

value attribute is used with input element to repopulate if form is not validated. but what to do with textarea. it has no value attribute. so tis not working i.e the textarea is not repopulated if validation is false

<textarea cols="16" rows="3" name="description"><?php echo $this->validation->description;?></textarea>

it works

That exact solution didn't work for me, but this did.
<textarea name="comment" rows="7" cols="27"><?php echo $this->form_validation->set_value('comment');?></textarea>

@maicobreako: there's also a shorthand version
// Long way
<textarea name="comment" class="inputs" rows="7" cols="27"><?php echo this->form_validation->set_value('comment');?></textarea>

// Short hand
<textarea name="comment" class="inputs" rows="7" cols="27"><?=set_value('comment')?></textarea>

set_value is a helper function, so it makes it a little bit less clittered

Thanks for that, I'll try it out right now!

Now don't I just feel special. On the line right above my textarea....
<input type="text" name="email" size="30" value="<?php echo set_value('email');?>" />

Well, uh....my computer has been acting strangely lately and I've been rather distracted...uh...well...uh... That's my story and I'm stickin' to it, I don't care whatch ya say!

How would you post the textarea of your form back to the controller?

Theme © iAndrew 2016 - Forum software by © MyBB