WebControlWrapper & EndOfLine

My HTML contains EndOfLine, or simply contains chr(13) in a dynamically generated HTML for the WebControlWrapper.
Before I use that HTML as WebControlWrapper’s HTML, I need to replace EndOfLine (as well as chr(13) ) with " " (space).
The HTML becomes very messy to view if needed.
Is there a way to keep EndOfLine within HTML code for the wrapper?
(Works just fine for Javascript, Fails in HTML)

Normally, EndOfLine or CR are ignored by the browser in HTML. From what I understands, Xojo does not parse HTML in a WebSDK control.

If that was not the case, you may want to file a bug report.

This would be a simple case:
(Code in the WebControlWrapper as Method salled “Setup”)

Dim tempHTML As String = "<HTML>" + EndOfLine + "</HTML>" Me.HTML = tempHTML

The HTML is Computed Property (as it is recommended in SDK) and the “Set” code is:

[code]mHTML = value

If ControlAvailableInBrowser() Then
ExecuteJavaScript(“Xojo.get(’” + me.ControlID + “’).innerHTML = '” + value + “’;”)

End If[/code]

This will say that HTML is not proper, and will raise Browser (IE11) Javascript error.

I tested, the error is: “Could not execute returned javascript: Unterminated string constant”

Ok, first of all, don’t include the tags. They are meant to define the beginning and end of the page, and the framework does that for you.

Besides that I don’t see anything else wrong here.

Regardless. Lets skip and use

instead. It will create the error.

Simply do a

value = ReplaceAll(ReplaceAll(value, EndOfLIne,""), &u0D, "")

before all the code.

Instead of ReplaceAll(value, EndOfLine, "") I would recommend to use ReplaceLineEndings(value, "") as this makes sure all line endings are replaced…

How about creating a sample project so I can take a look at this.

Hi Greg. Sorry I didn’t respond on time, I was on vacation.
I have created a project. How can I upload / send it so that you can see?

ok, after looking at the project, I see what’s going on.

The problem is that because your code is basically writing a javascript command, the command itself is invalid when it gets to the browser.

The code you have in the HTML setter looks like this:

Me.ExecuteJavaScript("Xojo.get('" + me.ControlID + "').innerHTML = '" + value + "';")

when that’s sent to the browser, the javascript looks like this:

[code]Xojo.get(‘xxxxxxxx’).innerHTML = ’

this will (not) work. Above and below this we have chr(13).


… and that’s invalid javascript code, and not a bug.