You are not logged in.
Hi,
This might seem a bit of a wacky thing to want to do, but basically I want to be able to change the values in the dropdown in the InsertWords plugin, depending upon certain user selections. It goes back to the server and refreshes the page after the User makes the selection, so I'm even trying to recreate the HTMLArea object with the new object array. For some reason, it doesn't work though.
Anyone have any suggestions as to the best way to do this? Do I need to get recreating the HTMLArea working, or can I simply replace the existing dropdown on the fly?
Thanks if you can help, I would greatly appreciate it. Great app, btw, we really like using it. I get jaws on the floor every time I demo it
Thanks,
Juo
Last edited by juo (2006-10-03 07:25:47)
Offline
Hi juo,
add this function to insert-words.js
InsertWords.prototype.newValues = function (id,newValues) {
var elem = this.editor._toolbarObjects[id].element;
while (elem.length > 1)
{
elem.options[1] = null;
}
for (var i in newValues)
{
var opt = new Option(i,newValues[i]);
elem[elem.length] = opt;
}
}
Call it for example by something like this:
<a href="javascript:void(0);" onclick="xinha_editors.myTextArea.plugins.InsertWords.instance.newValues('IW-id0',{option1:'text1',option2:'text2'});">New Options</a>
xinha_editors.myTextArea (replace myTextArea with your editor id) is the editor object, supposed you use the xinha_editors array.
The first parameter is the internal id of the dropdown. If you have more than one, change the number.
Last edited by ray (2006-10-17 05:22:48)
Offline
Hi ray,
That worked perfectly, its the exact solution I was looking for! Thanks a million, youre a star
(well, it works nearly perfectly, for some reason it doesn't work when the editor is first loaded, but subsequent javascript actions cause it to work. Appears the editor isn't present until the page is fully loaded, so looks like I just need to invoke the javascript to set the dropdown at the very end or something. I should be able to figure that out).
Should this be added to the source of the plugin? If anyone wants me to do this, let me know. Should I create a ticket?
Thanks again, I'm in your debt.
Regards,
juo
Offline