Hey,
I’m looking for a way to get the content of my div in my Rails view. I
would like the literal HTML content, so only HTML and no Rails
I thought inner_html would work, but I get a RJS exception (TypeError:
$(“content”).innerHtml is not a function)
Does anyone know how I can get the content? Thanks!
In my controller I use this code:
def save_test
render :update do |page|
page['content'].innerHTML
end
end
Some more context maybe? I get a HTML form (without the form tags
themselves) and put it into a rails form. What I want is that the user
changes checkboxes, radiobuttons, fills out input fields etc and when
the user saves, I want the literal changed content of the form as a
string to save it to my database.
The reason for this is that the several provided forms differ a lot and
it’s only used as information, no calculations etc need to be done on
it.
So my view looks like this:
form_remote_tag :url=>{:action => 'save_trainee_evaluation' do %>
<div id="content">
<%= contract_trainer_trainee.evaluation_template %>
</div>
<%= submit_tag 'Opslaan' %>
<% end %>