[html-formfu] Modifying generated html for some form elements
Nigel Metheringham
nigel.metheringham at dev.intechnology.co.uk
Wed Mar 10 12:39:18 GMT 2010
I am currently having an issue where I would like to try wrapping textarea elements into another element (either a div or a span), leaving their associated label elements outside (and I guess I should check this is legal HTML).
I am attempting to use TinyMCE to provide a GUI editor for some textarea form elements.
The generated HTML for that part of the form looks like this:-
<div class="textarea label">
<label for="f_blurb">Event Blurb</label>
<textarea name="blurb" cols="60" id="f_blurb" rows="10"></textarea>
</div>
and the associated CSS gives a nice layout where the textarea is offset to the right to line up with the input and other elements leaving the labels on the left.
If I add a little js to use TinyMCE to edit the textarea, the layout goes to pot - basically it floats left (on top of the label), and no I have found CSS manipulation to fix this other than absolute positioning of the editor.
The basic js to fire up TinyMCE (using the jquery variant) is in the form config like this (YAML format form configs):-
javascript: |
$('#f_blurb').tinymce({
script_url: '/static/js/tiny_mce/tiny_mce.js',
theme: "simple"
});
So I am now wondering if I can wrap the textarea in another element to give something like this:-
<div class="textarea label">
<label for="f_blurb">Event Blurb</label>
<div class="textarea_container">
<textarea name="blurb" cols="60" id="f_blurb" rows="10"></textarea>
</div>
</div>
push the div into the right place with CSS, and have TinyMCE then format correctly because it is contained within a positioned div.
So is there a clean way of modifying the HTML generation to do that?
[By the way this question of editor positioning appears to have been asked several times on the TinyMCE forums, without any decent answers, other than some fairly complex js to find the original positioning and the force the editor instance to that - which I was unable to make work when I tried it]
Cheers
Nigel.
--
[ Nigel Metheringham Nigel.Metheringham at InTechnology.com ]
[ - Comments in this message are my own and not ITO opinion/policy - ]
More information about the HTML-FormFu
mailing list