Take the 2-minute tour ×

I am trying to use WYSIHTML5 with Rails nested forms, using the nested_form gem.

My initial problem came up when generating a new set of fields through nested_form's link_to_add feature. From what I understand, it duplicates a pre-generated field (the "blueprint"). WYSIHTML5 uses iFrames and the iFrame content wasn't being copied over. The body was missing a contenteditable attribute, so it was pretty much useless. I managed to copy over all the missing attributes with nested_form's nested:fieldAdded javascript trigger.

So now everything is editable and looks right. New problem. The iframe is apparently not tied to the original textarea. I can type whatever I want to, but it doesn't get submitted with the form. I can't figure out what I'm missing here. The iframe doesn't have any id attribute or seemingly anything that would tie the two together.

Any help would be appreciated. If I left out any details, let me know.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Manually linking everything together turned out to be too much of a pain.

I basically ended up ignoring the blueprint textarea with $('.wysiwyg:not([id$="_blueprint"] .wysiwyg)'). Then on the nested:fieldAdded jQuery trigger, I select $('.wysiwyg-inactive:not([id$="_blueprint"] .wysiwyg)') and activate them, using wysiwyg-inactive and wysiwyg-active classes to make sure I don't double activate them

Sort of clean. Sort of simple. But there you have it.

share|improve this answer

Your Answer


