Announcement

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

#1 2006-06-26 06:06:37

dsuna
New member
Registered: 2006-06-26
Posts: 2

Lessons from a newbie experience

I just started using xinha.  My site is database driven and the ids of the text areas is not know ahead of time.  I did not see a way of dynamically defining the xinha_editors or adding fields to it after the fact.  To deal with this I took the definition of xinha_editors out of my_config.js and had php code that generated the definition of xinha_editors on the fly before I included my_config.js.  Since I am lazy I figured I would put out the list of fields for xinha_editors and then add a dummy field at the end of the list so I wouldn't have to put in the code to conditionally add a comma after a field if it wasn't the last one.  What I then ran into is that you must have text area fields for every entry in xinha_editors.  If not you get a javascript error (in the Firefox javascript console it said "textarea has no properties" on line 112).  Since I didn't see that mentioned in the forum I figured I would share the information.

I also found a number of people who ran into problems with the window.onload = xinha_init code in my_config.js.  Since this is just a way to ensure that the xinha_init code is called I took that out of my_config.js and called it explicitly when I finished generating the form with the text areas in it.

To summarize:
1. You can dynamically defined xinha_editors before calling my_config.js - just make sure to comment out the definition in my_config.js.
2. For every entry in xinha_editors you must have a textarea with that id.  Otherwise, it generates the textarea has no properties error and doesn't load the editor for any of the textareas.
3. You can explicitly call xinha_init rather than using window.onload (although window.onload should work as well)

Offline

Board footer

Powered by FluxBB