Hi Leszek,
Well, I got your answer and then had to go work on other things
instead! But I'm still a little confused, see below....
On Apr 18, 2006, at 12:53 PM, Leszek Gawron wrote:
Mark Lundquist wrote:
Hi folks,
Maybe someone can give me some ideas where to look in order to debug
this problem...
I'm trying to integrate the CForms HTMLArea support into an existing
Cocoon 2.1.8 applicaiton that uses CForms. Really, it's just
changing an existing textarea control into an "htmlarea" widget
(<fi:styling type="htmlarea"/>) and fixing up everything else so that
the string value gets serialized/parsed appropriately in all the
right places.
Anyway... the HTMLArea control is displayed and appears to be work
right, i.e. I can perform editing/authoring
operations, including adding links, making styling changes etc.
The problem is that when I submit the form, the new value of the
widget is not submitted. I fired up LiveHTTPHeaders in Mozilla, and
I can see that it's the old value in the POST request, not the new
one. I checked it at this level just to rule out any server-side
CForms botching that I may have going on.
The HTMLArea sample in the Cocoon distribution works fine for me.
It's just in my real application that I've got something fubar. I'm
using Firefox 1.5.0.2 and Moz 1.7.11.
I verified that the htmlarea.js script is able to load all of its
subsidiary scripts (even though HTMLArea doesn't work in Safari, I
fired up the page in Safari so that I could use its very handy
Activity window to make sure that everything is loading correctly).
Any ideas?
cocoon uses forms_onsubmit() and handles all submits not via
<input type="submit"/> but via <input type="button"
onclick="forms_onsubmit(...)"/>
this does not trigger the default form's onsubmit handler which
htmlarea overrides.
the most stupid way to fix that is:
<ft:form-template action="" method="post" name="edit">
<!-- bug workaround -->
<script type="text/javascript">
var handler = new Object();
handler.forms_onsubmit = function() {
document.edit.newsText.value =
document.edit.newsText.htmlarea.getHTML();
return true;
}
forms_onsubmitHandlers.push(handler);
</script>
OK, that all makes sense... but then why is it that the sample does not
seem to have this problem? The workaround you show isn't in the
template for the
sample, yet the reply page sent upon submission of the form correctly
shows the HTML generated by the htmlarea control...
Not Getting It, :-)
—ml—
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]