Hi,
It seems that IE7 doesn't respect name attribute of <input type="text" />.
It just strips it after you drag the input element.
Steps to reproduce:
- Open demo page in IE7.
- Run the script below using DebugBar or something else.
- Drag the input element and drop it somewhere in the beginning.
- View source.
- <input type="text" name="test" /> element is expected there, but it doesn't have NAME attribute.
var doc = FCKeditorAPI.GetInstance('FCKeditor1').EditorDocument; var t = doc.createElement('input'); t.setAttribute('type', 'text'); t.name = 'test'; doc.firstChild.lastChild.appendChild(t);
The same problem should be in any other WYSIWYG editor.
So the question is how to enforce IE to preserve and respect NAME attribute in FCK?
Thanks,
Dmitriy.
Re: IE strips name attributes after D&D
t.setAttribute('type', 'text');
to
t.type = "text";
IE6 used to have a problem with setting attributes available as DOM HTML properties through setAttribute. I don't know if IE7 still has it, but it's worth a try.
Re: IE strips name attributes after D&D
we've spent quite a lot of time to make sure that this kind of problem doesn't exist, but of course, if you want to directly manipulate the DOM then you have to recreate all the workarounds for IE bugs.
Re: IE strips name attributes after D&D
@ A.M. - tried - the same.
@alfonsoml. Thanks for the reply.
If I use built-in dialogs I don't see this problem. But I need to implement functionality for end user who doesn't know what NAME attribute is.
He/she just clicks a button and gets a predefined field (from the server) that must be used to submit data later.
So the built-in dialogs are not good enough because user should NOT specify any details about it in dialogs.
But using the API to create input elements sounds like a good solution.
I'm new to FCK and just don't see where to find the info on the API to manipulate INPUT elements.
Should I just use Editor.InsertElement(inputElement)?
How should I create elements themselves?
Could you please give more light on this?
Thanks in advance,
Dmitriy.
Re: IE strips name attributes after D&D
Have no success with Editor.InsertElement (CreateElement is the same function):
It inserts the new element but still after dragging (in IE7) it loses name attribute.
Anyway, am I going a right way with my trials?
Re: IE strips name attributes after D&D
Re: IE strips name attributes after D&D
Thanks for the info.
I'll try to dig into the dialogs' code and take small API portion from it for my app.
In case of success hope to share it somewhere here.
Re: IE strips name attributes after D&D
The only one function I need is (apart from those it relies on):
I need to pass oEditor which should be instance of FCKeditor (as doc mentions). But when I give it the instance (FCKeditorAPI.GetInstance('FCKeditor1')) it fails because of following objects are not part of the instance:
Looking at all this it seems that oEditor should be a window objects, but it still doesn't have those properties too.
Just to clarify what I tried:
So what should I pass as an oEditor parameter to this function?
Thanks,
Dmitriy.
Re: IE strips name attributes after D&D
Re: IE strips name attributes after D&D
If you call the code from a plugin then myFckHelper.CreateNamedElement(window, null, 'input', {name: 'test', type:'text'}) should work, but I guess that you are calling it from the external page, so you need to get the reference to the window where all the FCK objects live. (I don't remember right now how to call it, but also remember that many objects have aliases inside the FCK object so you might change the function to fit your needs)
Re: IE strips name attributes after D&D
That's exactly what I want to do: find that window with FCK object and related ones.
Just can't find out how to get it.
As far as I understand there are basically 2 windows - one is the main (external) window, second - is the iframe where FCK runs.
I tried to use following code (executed on external page) to get the FCK object (just on a demo page) with no success (it's undefined):
I also tried to search for that property in case I'm blind.
What are the other window objects that may contain FCK?
Thanks.
Re: IE strips name attributes after D&D
In this picture it's the iframe 2: http://alfonsoml.blogspot.com/2007/12/s ... ditor.html
Re: IE strips name attributes after D&D
Re: IE strips name attributes after D&D
run this in your url bar:
Re: IE strips name attributes after D&D
BTW, is there a way to obtain this window starting from FCKeditorAPI.GetInstance('FCKeditor1').Where.To.Go.From.Here?