[Phpwm] text counter in iframe

Phil Beynon phil at infolinkelectronics.co.uk
Sat Nov 25 02:01:23 GMT 2006


> Don't know if this actually can be done.......
>
> I've got an javascript and iframe based WYSIWYG data entry system
> on a page
> http://koivi.com/WYSIWYG-Editor/, this uses an iframe for flipping between
> text and html views and does pretty much all the normal stuff to
> text, bold,
> highlight, fonts, fonts size etc.
> Behind the scenes it uses a hidden textarea into which everything is moved
> prior to either submitting or spellchecking the users input.
>
> Separately I have a javascript text counter which works just fine within
> ordinary input and textarea type fields
> http://webonweboff.com/widgets/js/text_counter.aspx, displaying a
> countdown
> against a preset number of characters, when it hits zero no more
> characters
> are allowed to be added to the field, thus stopping any possible database
> field trucation.
>
> These bits works fine by themselves, no issues at all.
>
>
> If I unhide the textarea and tell the textcounter to look at the textarea
> created I can see that any text that I tell it to spell check appears in
> there, sent across via a document.write but the textcounter routine doesnt
> act on it immediately in the same way as text typed into the textarea, in
> fact it doesnt seem to get invoked at all until something is
> typed into the
> textarea, despite being triggered by an onchange.
> I can see that the textcounter might not be happy as such with the iframe
> area since this is effectively away from the current page, but I'd have
> though that a document.write to the textarea should have triggered the
> onchange in the seperate textcounter routine, or am I missing something
> obvious there!
>
> Phil
>

I'm answering my own posts now..........

I've given up on this now, plan B is much simpler; to give the user a
javascript kickback to the initial page if they exceed the maximum lengths
for the fields where the fields are done via the editor.

I've spent a while looking at this now, too long probably, and can't see any
wysiwyg editor anywhere, free or expensive, that seem to have this
capability enabled.
I suspect that it is something to do with the nature of the iframe and the
way data can be passed back and forth in javascript from a security
viewpoint.
Plus as I see it the best you could ever achieve is to issue a warning to
the user, since the html editor part of it would always have to complete its
tag set, if locked out part way through a document.write it would be "bad".

Not to worry!

Phil





More information about the Phpwm mailing list