You are not logged in.
Pages: 1
Ok, I love the RTE Editor but I want to be able to use it dynamically.
I have an ASP application where I a retrieve the fields from a table and want to show a xhina form element when the field is a certain type (Long Text Field).
I know my field names are unique so I would like to use these for the 'ID' element in the Textarea. Problem is, I have to pre-define the ID elements in the XhinaConfig.js! The only thing I can think of is to dynamically rewrite the Config file each time the page is loaded to add the IDs which are generated. The ASP application is HTML driven including adding new fields etc., so I will never absolutely know what the field ID is in advance.
Any suggestions?
Offline
A bit of inline JS in your HTML would do the trick. Define a array with the field ids you need to be replaced in your HTML and use that array in XinhaConfig.js instead. Just make sure the array is defined before your loading code is executed.
My config file has been modified much but I think the original array name is xinha_editors.
Have fun!
Offline
Well, I have included the Javascript calls in an ASP include and generated page level field IDs in there using response.write. This will dynamically populate the XhinaConfig options with the correctly named and right number of TextArea elements. My included ASP file now looks something like this:
<script type="text/javascript">
/* This compressed file is part of Xinha. For uncomressed sources, forum, and bug reports, go to xinha.org */
xinha_editors=null;
xinha_init=null;
xinha_config=null;
xinha_plugins=null;
xinha_init=xinha_init?xinha_init:function(){
xinha_editors=xinha_editors?xinha_editors:[<%
For iCount = 1 to iNumOfFields
Response.write """" & FieldID & ""","
Next
%>"Default"];
xinha_plugins=xinha_plugins?xinha_plugins:["CharacterMap"];
if(!Xinha.loadPlugins(xinha_plugins,xinha_init)){
return;
}
xinha_config=xinha_config?xinha_config():new Xinha.Config();
xinha_config.pageStyleSheets=[_editor_url+"examples/full_example.css"];
xinha_editors=Xinha.makeEditors(xinha_editors,xinha_config,xinha_plugins);
Xinha.startEditors(xinha_editors);
};
Xinha._addEvent(window,"load",xinha_init);
</script>
I appreciate the response, many thanks.
Last edited by Remy (2007-11-09 12:59:01)
Offline
Pages: 1