using respond_to format.js to replace the content of a textarea on rails

Posted by Stacia on Stack Overflow See other posts from Stack Overflow or by Stacia
Published on 2010-01-11T20:46:50Z Indexed on 2010/04/01 10:03 UTC
Read the original article Hit count: 180

I have some saved text in my create controller. If it's not stressful, I'd like it to populate a textarea on the page with the saved text along with displaying the error message fields (which is what's already happening). I've used things like replace_html before, but I don't know if there's an easy way to get to textarea or text field IDs and just replace the value of the text. For now I'm just going to do some javascript but it would be nice to know the rails shortcut.

edit: I wasn't in the right mindset because this app uses extjs and was trying to figure out how to do it this way. The text box is actually an ext status bar (same as here : http://www.extjs.com/deploy/dev/examples/statusbar/statusbar-demo.html ) which doesn't get created until the page is finished loading. When I try to enter commnands like the first poster suggested, I get "setvalue is not a function". Playing with firebug on the page I can get it to set the value after loading by using (whatever method to get it through ext or scriptaculous).value = "lol" but none of the page update things work with this.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about respond-to