I am embedding tinymce [http://www.tinymce.com/] in twitter bootstrap form , so that user can input formatted text which I can persist to a postgres database.
The probl
Basically, the simplest way to do this is through adding a hidden field to your form and a click event handler on the submit button.
so, create a hidden input on your format, with the name "message_formatted" (since I imagine your corresponding field in your model is called message_formatted), and change the name of your textarea to something else, as that will no longer be important.
using jQuery:
$('#signup input[type=submit]').click(function(e){
$('input[name=message_formatted]').val(tinyMCE.get('content id').getContent());
});
In terms of where to add the javascript, that's up to you. It's best to place it in a javascripts directory (it's unclear whether you're using Rails and the asset pipeline or not). If you want to just add the javascript inline within this haml page, place the above within the content_for :javascript do
at the bottom of your page
content_for :javascript do
// enter the javascript from above here