html_area var troubles

Code:
var m = '\

\ \ \ Create Map\ \ \ \ \ \ \ \
\ BBC\ \ '

What I am getting:
“<meta http-equiv=\“Content-Type\” content=\“text/html; charset=utf-8\”/>Create Map<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 type=\“text/javascript\” src=\“http://serverapi.arcgisonline.com/jsapi/arcgis/?v=1.3\\”><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);<div id=\“map\” style=\“width:900px; height:600px; border:1px solid #000;\”><a target=\“_BLANK\” href=\“http://www.bbc.co.uk\”>BBC"

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?

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.

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

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

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.

Does my version work in both cases?

Hi

No it seems to work only when I open the html_area in a new dialogue form, in both cases.

Try taking off the <!DOC TYPE... and just begin with ""…

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:

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 *BBC* does show up. Are there issues with utilizing div tags within the html_area?

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 ?

How is:

dojo.addOnLoad(init);

getting fired?

Hi

I believe the ```
dojo.addOnLoad(init);


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?

Hi all,

I’ve come accross ```
currentcontroller.show(forms.mm_map_lines);


I've narrowed it down to the line:
\

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"]

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.

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?

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.

Hi johan,

Thank you for the reply.

Could you please give me an example of how this works? I’m new to servoy and javascript and am totally lost at this point. thanks

But you are already doing al that stuff:

<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

that has to be done in the Main page itself.
The usage of that stuff can then be done in another form.

I think that last init() can maybe be moved to the tab form also so this part:

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);\

Hi Johan,
I have attempted your solution and am unable to achieve what you have described to me.

my main form has method to open in dialog that looks like this:

function openWizard()
{
wizard_markup = '<html>\
<head>\
<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");\
\
</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>';

  application.showFormInDialog('mm_wizard',20,100,895,580,'Merge Move Wizard',false,false,'mm_wizard',true);
}

This runs fine and displays an empty html_area. I then click next until I hit the map tab.

the mm_wizard then has a button event that will move through the tabs.

function NextStep_Click()
{
	if ( elements.tabs.tabIndex  < elements.tabs.getMaxTabIndex() + 1)
	{
		elements.tabs.tabIndex = elements.tabs.tabIndex + 1 ;
	}

When the user gets to the tab that will display the html_area i call onShow()

function onShow()
{
   initMap();
}

function initMap()
{
  fv_mm_mark_up = '<html>\
<head>\
<script type="text/javascript">\
\
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>';
}

When I do this the map shows up in the hidden html_area on the main form and not in the mapping tab.

any ideas on what I am doing wrong?

no you have to dig into the dojo lib for this
i have no idea, i guess you now bind it on a div in the main page instead of a div in a tab.

HI,
thanks for the reply. and all of your help. I gave up on that for now, but will revisit the issue at a later date. I just can’t seem to understand what it is that is causing this problem. If anyone has any ideas on how to solve this please feel free to post your solution. Thanks