Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2006-04-01 09:40:13

quayfee
New member
Registered: 2006-04-01
Posts: 7

Loading Xinha Textarea through AJAX call

Hi all,

I'm trying to load a simple form (two fields and an submit button) with one field enhanced with Xinha. I can load the form as a page in it's own right (own browser window called directly) and the form loads with Xinha perfectly. When I call the same file through an XMLHttpRequest xinha does not load.

Any ideas or suggestions?

TIA

Quayfee

Offline

#2 2006-04-03 09:45:35

Mousy
Xinha Community Member
From: Amsterdam, Netherlands
Registered: 2006-02-21
Posts: 10

Re: Loading Xinha Textarea through AJAX call

I guess Xinha loads on pageload, so if you do it by XMLHttpRequest it does not have the pageload triggered?

Offline

#3 2006-04-03 10:02:15

quayfee
New member
Registered: 2006-04-01
Posts: 7

Re: Loading Xinha Textarea through AJAX call

Hi Mousy,

By derfault, yes XInha will load with the window.onload method. I thikn you can call it to initialise from an event handler as well, but I've not had much success with that.

This issue with call it from AJAX is that the code created by the external file (whether a php file or any other language) is simply replacing the HTML that is in whatever element is targeted, any javascript on the page has already bee run. I'm sure it's possible, in fact  I've sen various mentions from far more experienced programmers in other forums that they have managed to do it. Unfortunately they haven't actually posted details of how sad.

Cheers

Keith

Offline

#4 2006-04-10 14:24:03

rehe
New member
Registered: 2006-04-10
Posts: 1

Re: Loading Xinha Textarea through AJAX call

Hi,
you asked for details. heres is how i did it. the code is just a snippet, so i hope, you understand it.
if not, just have a look how the editors are normally made with the onload-handler.

good luck.
   

// new object
    Xinha_names = new Object();
   
// array for editors
    xinha_editors = new Array();

// array for plugins 
  xinha_editors_plugins = new Array();

// first editor name: eingeschlossene_leistungen

// arguments[1][2] is an argument given from sajax-0.10
// set the name of the new editor
    var informationen = 'reise'+arguments[1][2]+'informationen';
// make it a new element in the xinha_editors-array
    xinha_editors.push(informationen);
// also in the plugins-array
    xinha_editors_plugins.push(informationen);
    xinha_editors_plugins[informationen] =
    ['CharacterMap','ContextMenu', 'FullScreen',
    'ListType','SuperClean','TableOperations',
    'DynamicCSS','EditTag','Equation','Abbreviation', 
    'FindReplace','LangMarks','QuickTag',
    'CManDokument','CManBild','InsertAnchor','CManLink'];
   
// all again for the second editor
    var eingeschlossene_leistungen = 'reise'+arguments[1][2]+'eingeschlossene_leistungen';
    xinha_editors.push(eingeschlossene_leistungen);
    xinha_editors_plugins.push(eingeschlossene_leistungen);
    xinha_editors_plugins[eingeschlossene_leistungen] =
    ['CharacterMap','ContextMenu', 'FullScreen',
    'ListType','SuperClean','TableOperations',
    'DynamicCSS','EditTag','Equation','Abbreviation', 
    'FindReplace','LangMarks','QuickTag',
    'CManDokument','CManBild','InsertAnchor','CManLink'];
   
// ... and for the third
    var sonstiges = 'reise'+arguments[1][2]+'sonstiges';
    xinha_editors.push(sonstiges);
    xinha_editors_plugins.push(sonstiges);
    xinha_editors_plugins[sonstiges] =
    ['CharacterMap','ContextMenu', 
    'ListType','SuperClean','TableOperations',
    'DynamicCSS','EditTag','Equation','Abbreviation', 
    'FindReplace','LangMarks','QuickTag',
    'CManDokument','CManBild','InsertAnchor','CManLink'];
   
// make the editors
    xinha_editors   = HTMLArea.makeEditors(xinha_editors, xinha_config);
   
// set the plugins for the editors
    xinha_editors[informationen].registerPlugins(xinha_editors_plugins[informationen]);
    xinha_editors[eingeschlossene_leistungen].registerPlugins(xinha_editors_plugins[eingeschlossene_leistungen]);
    xinha_editors[sonstiges].registerPlugins(xinha_editors_plugins[sonstiges]);

// show the editors   
    HTMLArea.startEditors(xinha_editors);

Last edited by rehe (2006-04-10 14:49:43)

Offline

Board footer

Powered by FluxBB