html_area var troubles

Questions, tips and tricks and techniques for scripting in Servoy

html_area var troubles

Postby eKelman » Tue May 12, 2009 9:33 pm

Code:
var m = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\
<html>\
<head>\
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>\
<title>Create Map</title>\
<link target="_BLANK" rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/1.3/js/dojo/dijit/themes/tundra/tundra.css">\
<script type="text/javascript">djConfig = { parseOnLoad:true }</script>\
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=1.3"></script>\
\
<script type="text/javascript">\
dojo.require("esri.map");\
dojo.require("esri.toolbars.navigation");\
dojo.require("esri.toolbars.draw");\
dojo.require("dijit.form.Button");\
dojo.require("dijit.Toolbar");\
\
function init() {\
var map = new esri.Map("map");\
var tiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer");\
map.addLayer(tiledMapServiceLayer);\
}\
\
dojo.addOnLoad(init);\
\
</script>\
</head>\
<body>\
<div id="map" style="width:900px; height:600px; border:1px solid #000;"></div>\
<a target="_BLANK" href="http://www.bbc.co.uk">BBC</a>\
</body>\
</html>'

What I am getting:
"<!DOCTYPE HTML PUBLIC \\"-//W3C//DTD HTML 4.01//EN\\" \\"http://www.w3.org/TR/html4/strict.dtd\\"><html><head><meta http-equiv=\\"Content-Type\\" content=\\"text/html; charset=utf-8\\"/><title>Create Map</title><link target=\\"_BLANK\\" rel=\\"stylesheet\\" type=\\"text/css\\" href=\\"http://serverapi.arcgisonline.com/jsapi/arcgis/1.3/js/dojo/dijit/themes/tundra/tundra.css\\"><script type=\\"text/javascript\\">djConfig = { parseOnLoad:true }</script><script type=\\"text/javascript\\" src=\\"http://serverapi.arcgisonline.com/jsapi/arcgis/?v=1.3\\"></script><script type=\\"text/javascript\\">dojo.require(\\"esri.map\\");dojo.require(\\"esri.toolbars.navigation\\");dojo.require(\\"esri.toolbars.draw\\");dojo.require(\\"dijit.form.Button\\");dojo.require(\\"dijit.Toolbar\\");function init() {var map = new esri.Map(\\"map\\");var tiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer(\\"http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer\\");map.addLayer(tiledMapServiceLayer);}dojo.addOnLoad(init);</script></head><body><div id=\\"map\\" style=\\"width:900px; height:600px; border:1px solid #000;\\"></div><a target=\\"_BLANK\\" href=\\"http://www.bbc.co.uk\\">BBC</a></body></html>"


The problem are the escape characters being added to this string variable won't execute in the HTML_AREA field. Is there any way around this? Is there a way to have the variable only take in the actual string value without the escape characters?
Ernest
Kelman Technologies
eKelman
 
Posts: 52
Joined: Tue May 12, 2009 9:09 pm

Re: html_area var troubles

Postby eKelman » Tue May 12, 2009 10:43 pm

i forgot to add, that this code seems to work if opened in a new dialogue, however, I don't want to have to open a new window for something like this to function.
Ernest
Kelman Technologies
eKelman
 
Posts: 52
Joined: Tue May 12, 2009 9:09 pm

Re: html_area var troubles

Postby david » Tue May 12, 2009 10:53 pm

I think you'll probably have to go this route:

Code: Select all
var m = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">'
m += '<html>'
m += '<head>'
...
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: html_area var troubles

Postby eKelman » Wed May 13, 2009 5:05 pm

Hi David,

Thanks for the reply. The html seems to work when I open a new dialogue, but doesn't seem to work when it is opened as a dialogue that has been opened to mimic a wizard. I am not sure if there is a difference with the way servoy repaints the html area after it has been populated if it is opened in a new dialogue or if it has been populated in the dialogue wizard at a later state.
Ernest
Kelman Technologies
eKelman
 
Posts: 52
Joined: Tue May 12, 2009 9:09 pm

Re: html_area var troubles

Postby david » Wed May 13, 2009 9:23 pm

Does my version work in both cases?
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: html_area var troubles

Postby eKelman » Wed May 13, 2009 10:22 pm

Hi

No it seems to work only when I open the html_area in a new dialogue form, in both cases.
Ernest
Kelman Technologies
eKelman
 
Posts: 52
Joined: Tue May 12, 2009 9:09 pm

Re: html_area var troubles

Postby bobcusick » Wed May 13, 2009 11:11 pm

Try taking off the <!DOC TYPE... and just begin with "<html>"....
User avatar
bobcusick
 
Posts: 126
Joined: Mon Jan 12, 2009 9:13 pm

Re: html_area var troubles

Postby eKelman » Thu May 14, 2009 12:53 am

Hi bob,
thank you for the response. I have actually tried that and it still doesn't want to display in the html_area.

The code looks like this at the moment:
Code: Select all
var mm_markup_test = '<html>\
<head>\
    <title>Create Map</title>\
    <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/1.3/js/dojo/dijit/themes/tundra/tundra.css">\
    <script type="text/javascript">djConfig = { parseOnLoad:true }</script>\
    <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=1.3&output=json&callback=ws_results"></script>\
\
    <script type="text/javascript">\
        dojo.require("esri.map");\
        dojo.require("esri.toolbars.navigation");\
        dojo.require("esri.toolbars.draw");\
        dojo.require("dijit.form.Button");\
        dojo.require("dijit.Toolbar");\
\
        function init() {\
           var map = new esri.Map("map");\
           var tiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer");\
           map.addLayer(tiledMapServiceLayer);\
        }\
\
        dojo.addOnLoad(init);\
    </script>\
    </head>\
    <body class="tundra">\
        <div id="map" style="width:500px; height:400px; border:1px solid #000;"></div>\
        <a target="_BLANK" href="http://www.bbc.co.uk">BBC</a>\
    </body>\
</html>';


And I just can't figure out why it won't display unless a new dialogue is created? are there other events for painting/rendering etc that need to invoked for this html_area to handle the html correctly. I will have to add that the <a target="_BLANK" href="http://www.bbc.co.uk">BBC</a>\ does show up. Are there issues with utilizing div tags within the html_area?
Ernest
Kelman Technologies
eKelman
 
Posts: 52
Joined: Tue May 12, 2009 9:09 pm

Re: html_area var troubles

Postby lvostinar » Thu May 14, 2009 10:40 am

You can add a case in our support system: http://crm.servoy.com/servoy-webclient/ ... oy_support . Also, please attach a small sample. Is this in smart client or in web client ?
Laurian Vostinar
Servoy
lvostinar
 
Posts: 1062
Joined: Tue Feb 19, 2008 10:53 am

Re: html_area var troubles

Postby david » Thu May 14, 2009 1:38 pm

How is:

Code: Select all
dojo.addOnLoad(init);


getting fired?
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: html_area var troubles

Postby eKelman » Thu May 14, 2009 7:23 pm

Hi

I believe the
Code: Select all
dojo.addOnLoad(init);
does fire.

I have been able to get around this issue and display in the html_area by calling controller.show after the html_area /markup has been set.

The problem I am running into with this is that it is resetting the main dialogue to only display this child form and removing the parent form buttons in the main dialogue.

Is there any other method that would do what controller.show would do, without resetting the parent dialogue display/layout?
Ernest
Kelman Technologies
eKelman
 
Posts: 52
Joined: Tue May 12, 2009 9:09 pm

Re: html_area var troubles

Postby eKelman » Fri May 15, 2009 10:04 pm

Hi all,

I've come accross
Code: Select all
  currentcontroller.show(forms.mm_map_lines);
which will set the main form the users are on, to the forms_mm_map_lines form, and then load it into the wizard correctly. Is there any way to call one of these functions without loading resetting the main form to the mm_map_lines form I am trying to repaint?

I've narrowed it down to the line:
Code: Select all
  <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=1.3"></script>\


This line does not seem to work unless the form repaints itself. Any ideas on what I am doing wrong?

I have also opened the mm_map_lines form in its own dialogue and added a button to load the html when the user clicks the button but the problem still exists. Are there any other methods I can invoke to repaint this form?

I am also getting this error in the error console:
Error: uncaught exception: [Exception... "Access to restricted URI denied" code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)" location: "http://localhost:8080/servoy-webclient/resources/wicketajax/wicket-ajax.js Line: 632"]
Ernest
Kelman Technologies
eKelman
 
Posts: 52
Joined: Tue May 12, 2009 9:09 pm

Re: html_area var troubles

Postby jcompagner » Mon May 18, 2009 6:25 pm

ahh yes i think i know what you encounter

Dojo is a shitty js lib if you ask me, because if i am right dojo doesnt allow itself to be loaded inside an ajax request...

Thats why it works if you set it as a main form first because then dojo is initialized in a normal browser request
But if you do it by adding a tab through ajax (or something like that) dojo will not work because of the stupid design of dojo itself.

So if you want this to work i think your mainpage already have to have dojo included so that it is already initialized
and then later on you can reuse it in a tab.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: html_area var troubles

Postby eKelman » Tue May 19, 2009 5:59 pm

hi jcompagner,

I see what you are saying, and it is starting to make more sense as to why the esri maps don't load, and that would probably be because they utilize dojo.

Now can I ask how do i go about loading dojo the way you have explained?
Ernest
Kelman Technologies
eKelman
 
Posts: 52
Joined: Tue May 12, 2009 9:09 pm

Re: html_area var troubles

Postby jcompagner » Tue May 19, 2009 10:13 pm

load the dojo libs always as a lib (so in a hidden html area) in your main page.
So that it is loaded with a full browser request.

then just reuse those libs on other tab forms.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Next

Return to Methods

Who is online

Users browsing this forum: Bing [Bot] and 32 guests