- 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);same problem

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
where to find
Re: IE strips name attributes after D&D
FCKeditorAPI.GetInstance('FCKeditor1').InsertHtml("<input type='text' name='test' title='Hello' />")Have no success with Editor.InsertElement (CreateElement is the same function):
var t = FCKeditorAPI.GetInstance('FCKeditor1').EditorDocument.createElement('input'); t.type = 'text'; t.name = 'test'; t.title = 'Hello' FCKeditorAPI.GetInstance('FCKeditor1').InsertElement(t);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):
/* from fck_dialog_common.js*/ /** Utility function to create/update an element with a name attribute in IE, so it behaves properly when moved around It also allows to change the name or other special attributes in an existing node oEditor : instance of FCKeditor where the element will be created oOriginal : current element being edited or null if it has to be created nodeName : string with the name of the element to create oAttributes : Hash object with the attributes that must be set at creation time in IE Those attributes will be set also after the element has been created for any other browser to avoid redudant code */ function CreateNamedElement( oEditor, oOriginal, nodeName, oAttributes ) { /* It internally uses: oEditor.FCKBrowserInfo oEditor.FCKListsLib oEditor.FCK oEditor.FCKDomTools */ }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
demo page
window.FCK // is undefined FCKeditorAPI.GetInstance('FCKeditor1').EditorWindow.FCK // is undefinedtried to search
Re: IE strips name attributes after D&D
Re: IE strips name attributes after D&D
Re: IE strips name attributes after D&D
run this in your url bar:
javascript:void(alert(document.getElementById('FCKeditor1___Frame').contentWindow.FCKDomTools))Re: IE strips name attributes after D&D
document.getElementById('FCKeditor1___Frame').contentWindowBTW, is there a way to obtain this window starting from FCKeditorAPI.GetInstance('FCKeditor1').Where.To.Go.From.Here?