Announcement

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

#1 2005-03-19 18:04:34

Yermo
Xinha Authority
From: College Park, Md, USA
Registered: 2005-02-13
Posts: 143
Website

Preferred way of setting content into Xinha?

I'm running into a problem where Xinha in FireFox (on Windows and Linux) is for some reason losing some spaces. For example "this is a test" might become "thisisatest".

It might be due to my changes I've made so I haven't created a ticket until I can demonstrate that it's not something I've done.

What is the preferred way of setting content loaded from a database into Xinha? I'm currently just setting the value of the textarea field to some html as in:

document.text_01.staging_text_content.value='<p>this is  atest</p>';

Is there a better way?


-----------------------------------------------------------------------------------------
Content Management with Business Intelligence      [url]http://www.formvista.com[/url]

Offline

#2 2005-03-19 18:14:21

adamp
Xinha Pro
Registered: 2005-03-14
Posts: 77

Re: Preferred way of setting content into Xinha?

I just put the content in the textarea as one normally would (run through htmlspecialchars() in PHP to avoid problems), e.g.

<textarea name="ta" id="ta"><?php echo htmlspecialschars($content); ?></textarea>

EDIT: added the PHP in to possibly explain better

Last edited by adamp (2005-03-19 18:15:22)

Offline

#3 2005-03-19 18:19:51

Yermo
Xinha Authority
From: College Park, Md, USA
Registered: 2005-02-13
Posts: 143
Website

Re: Preferred way of setting content into Xinha?

adamp wrote:

I just put the content in the textarea as one normally would (run through htmlspecialchars() in PHP to avoid problems), e.g.

<textarea name="ta" id="ta"><?php echo htmlspecialschars($content); ?></textarea>

EDIT: added the PHP in to possibly explain better

I used to do it that way but ran into alot of trouble when users started trying to enter HTML .. it was screwing up the editor itself. I believe the &blah; characters were getting interpreted or some such as the editor was loaded.

It's always possible I was doing something incorrectly.


-----------------------------------------------------------------------------------------
Content Management with Business Intelligence      [url]http://www.formvista.com[/url]

Offline

#4 2005-03-19 18:38:08

adamp
Xinha Pro
Registered: 2005-03-14
Posts: 77

Re: Preferred way of setting content into Xinha?

That's what htmlspecialchars() is for. Can't say I've had any trouble with it.

Offline

#5 2005-03-19 22:37:30

gogo
Xinha Leader
From: New Zealand
Registered: 2005-02-11
Posts: 1,015
Website

Re: Preferred way of setting content into Xinha?

I've always just put it in the textarea body using (more or less) htmlspecialchars.


James Sleeman

Offline

#6 2005-03-19 22:39:05

gogo
Xinha Leader
From: New Zealand
Registered: 2005-02-11
Posts: 1,015
Website

Re: Preferred way of setting content into Xinha?

That said, setting textarea.value should work fine too. 

Check it out against a fresh copy of the nightly, I can't think of anything that would do that.


James Sleeman

Offline

#7 2005-03-20 01:04:05

Yermo
Xinha Authority
From: College Park, Md, USA
Registered: 2005-02-13
Posts: 143
Website

Re: Preferred way of setting content into Xinha?

gogo wrote:

That said, setting textarea.value should work fine too. 

Check it out against a fresh copy of the nightly, I can't think of anything that would do that.

See bug 78. There's some issue around line 258 "var holdEnd = this.forEachNodeUnder(pEnd[2], this._fenEmptySet, true, false, true);" in EnterParagraphs.

holdEnd is assumed to be an object but in the case described in the bug it contains false so the "sel.collapse(holdEnd, 0);" fails. I believe this is probably related to the spaces problem. When the spaces problem occurs it generates an exception on the same line ...

I'll delve into further. This one is causing me an immediate headache.


-----------------------------------------------------------------------------------------
Content Management with Business Intelligence      [url]http://www.formvista.com[/url]

Offline

#8 2005-03-20 01:20:13

Yermo
Xinha Authority
From: College Park, Md, USA
Registered: 2005-02-13
Posts: 143
Website

Re: Preferred way of setting content into Xinha?

gogo wrote:

That said, setting textarea.value should work fine too. 

Check it out against a fresh copy of the nightly, I can't think of anything that would do that.

Turns out the stripping out spaces issue is my own bug and probably has nothing to do with Xinha.


-----------------------------------------------------------------------------------------
Content Management with Business Intelligence      [url]http://www.formvista.com[/url]

Offline

Board footer

Powered by FluxBB