# Update a textarea with RJS

**URL:** <https://www.ruby-forum.com/t/update-a-textarea-with-rjs/89815>\
**Category:** Rails\
**Created:** [March 22, 2007, 10:24pm UTC](https://www.ruby-forum.com/t/update-a-textarea-with-rjs/89815 "2007-03-22T22:24:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bolo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/898d66/32.png) [@Bolo](https://www.ruby-forum.com/u/Bolo)\
**Post date:** [March 22, 2007, 10:24pm UTC](https://www.ruby-forum.com/t/update-a-textarea-with-rjs/89815/1 "2007-03-22T22:24:39Z")

</div>

Hello

I would like a update a texteara with JS. with this simple code. It’s  
working well

RJS  
page[“objectif”].value = “test”

View  
\<%= f.text\_area :objectif, :rows =\> 10 , :cols =\> 55 , :id =\>  
“objectif”%\>

But when i try to test this code  
page[“objectif”].value = page[“textarea”].value

 Objectfis ![Ajouter un document]() 
### Objectifs :
\<%= f.text\_area :objectif, :rows =\> 10 , :cols =\> 55 , :id =\> "objectif"%\>

No working. Can you help me

---

<div class="post-metadata">

**Author:** ![Bolo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/898d66/32.png) [@Bolo](https://www.ruby-forum.com/u/Bolo)\
**Post date:** [March 23, 2007, 1:50am UTC](https://www.ruby-forum.com/t/update-a-textarea-with-rjs/89815/2 "2007-03-23T01:50:09Z")

</div>

Bolo wrote:

> Hello
> 
> I would like a update a texteara with JS. with this simple code. It’s  
> working well
> 
> RJS  
> page[“objectif”].value = “test”
> 
> View  
> \<%= f.text\_area :objectif, :rows =\> 10 , :cols =\> 55 , :id =\>  
> “objectif”%\>
> 
> But when i try to test this code  
> page[“objectif”].value = page[“textarea”].value
> 
> Objectfis ![Ajouter un document]() 
> ### Objectifs :
> \<%= f.text\_area :objectif, :rows =\> 10 , :cols =\> 55 , :id =\> "objectif"%\>
> 
> No working. Can you help me

page[“textarea”].value isn’t a valid value. I am assuming your element  
with ID textarea is a select drop down list, then it should be something  
like this

page[“objectif”].value =  
page[“textarea”].options[page[“textarea”].selectedIndex].value

---

<div class="post-metadata">

**Author:** ![Bolo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/898d66/32.png) [@Bolo](https://www.ruby-forum.com/u/Bolo)\
**Post date:** [March 23, 2007, 9:02pm UTC](https://www.ruby-forum.com/t/update-a-textarea-with-rjs/89815/3 "2007-03-23T21:02:12Z")

</div>

Hello

i was testing this

@value =  
page[“textarea”].options[page[“textarea”].selectedIndex].value

i have an error

[Break on this error] $  
(“textarea”).selectedIndex().#\<ActionView::Helpers::JavaScriptElementProxy:  
0x30…

On Mar 22, 8:50 pm, Wai T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
