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


i have saved text in create controller. if it's not stressful, i'd populate textarea on page saved text along displaying error message fields (which what's happening). i've used things replace_html before, don't know if there's easy way textarea or text field ids , replace value of text. i'm going javascript nice know rails shortcut.

edit: wasn't in right mindset because app uses extjs , trying figure out how way. text box ext status bar (same here : http://www.extjs.com/deploy/dev/examples/statusbar/statusbar-demo.html ) doesn't created until page finished loading. when try enter commnands first poster suggested, "setvalue not function". playing firebug on page can set value after loading using (whatever method through ext or scriptaculous).value = "lol" none of page update things work this.

in render |page| can use "page <<" pass inline js can invoke setvalue on texfield element

prototype:

page << "$('texfield_id').setvalue('lol');"  page << "$('texfield_id').setvalue('#{your_value}');"  # if use rails-like helpers (wich not) work page[:textfield_id].setvalue your_value  

jquery:

page << "$('#tf_id').val('lol');" 

enjoy


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -