Remote function

I have a form to edit a page, with its nice save button. Since it’s in
textile I’m writing a preview button which renders the content to html
and put it in a div.

But, how can I pass to the remote function the current content of the
text area?

something like this

remote function( update => mydiv, ulr => (:action => textiler),
arguments => (text => textarea.value) )

of course that doesn’t work, just to make myself understood

bye
thanks

Try something like this…

In the view

link_to_remote ‘Select’,
:url => {:action => ‘generate_preview’},
:with => “‘text_area_value=’ +
document.getElementById(‘someTextAreaID’).value”

In the controller

def generate_preview
textAreaValue = params[‘text_area_value’]

#other_stuff
end

The :with option isn’t very well documented… It works with
link_to_remote, but doesn’t seem to work with form_remote. It might
work with some button_* helpers, or whatever… I don’t know.

great it works like a charm!

thanks

On Sep 19, 6:41 pm, Dave S. [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs