You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Igor devor <de...@exotismes.com> on 2006/09/13 16:14:01 UTC

myfaces + dojo = Error running scripts from content:[object Error].

Hi,
 
    I have include some dojo in jsf page, an use some ajax.
    But in internet explorer i have an error after dojo load an page : 
    Error running scripts from content:[object Error].
    
    I serach and i find why :
 
    MyFace generate this javascript : 
 
<script type="text/javascript"><!--
function getScrolling() {
    var x = 0; var y = 0;
    if (self.pageXOffset || self.pageYOffset) {
        x = self.pageXOffset;
        y = self.pageYOffset;

        (....)
 
or this :
 
<script type="text/javascript"><!--
function clear_floatform() {
  var f = document.forms['floatform'];
  f.elements['floatform:_link_hidden_'].value='';
  f.target='';
}
(...)
 
 
 And the error happend because the <!-- start tag is not preceded by
javascript comment // 

So, how can i change this :
<script type="text/javascript"><!--

By :
<script type="text/javascript">//<!--
 
Or perhaps disable javascript generation only for this page.
 
Thanks.
Igor


Re: myfaces + dojo = Error running scripts from content:[object Error].

Posted by Werner Punz <we...@gmx.at>.
Ok I do not see too many errors here, except one thing.

You initialize dojo in the body, in the past this has been problematic
due to the fact that some dojo components hook themselves into onload.

The better strategy is to move the

atim escape="false">
> 		<script type="text/javascript">
> 			var djConfig = {isDebug: true };
> 		</script>
> 		<script type="text/javascript"
> src="/site/dojo/dojo.js"></script>
> 		

into the head of your page to avoid sideffects.
Also enclose the script parts into the usual comment tags
this is closer to standard conformity and causes the browsers
to choke less.

Alternatively to your own dojo code, you can use our sandbox stuff
there is a control called dojoInitializer which basically does the
preinitialisation, also several examples are in the sandbox-examples
under the dojo dir, using the initializer and a mix of html
and jsf, or jsf only if possible already.

Dojo will be part of the core Tomahawk component library as well as the
initializer tag (and yet an undecided) number of existing sandbox
components in the upcoming myfaces 1.1.5 we are currently in the
beginning stages of the sandbox -> tomahawk migration.

The current version level of dojo in the sandbox is 0.3.1

Werner



Igor devor schrieb:
> I use dojo-0.3.1-ajax.zip
> I do not use any tag. It's initialize like this :
> 	<f:verbatim escape="false">
> 		<script type="text/javascript">
> 			var djConfig = {isDebug: true };
> 		</script>
> 		<script type="text/javascript"
> src="/site/dojo/dojo.js"></script>
> 		
> 		<script language="JavaScript" type="text/javascript">
> 			dojo.require("dojo.widget.*");
> 			dojo.require("dojo.widget.LayoutContainer");
> 			dojo.require("dojo.widget.FloatingPane");
> 			dojo.require("dojo.widget.ResizeHandle");
> 			
> 			
> 		function load(aid,id) {
> 		      var myPanel1 = dojo.widget.byId("paneOption");
> 	
> myPanel1.setUrl("/site/option.jsf?aid="+aid+"&brid="+id);
> 		      myPanel1.show();
> 		}
> 
> 		</script>
> 		<div dojoType="FloatingPane"
> 			id="paneOption"
> 			title="choisissez une option"
> 	
> iconSrc="/site/dojo/demos/widget/images/flatScreen.gif"
> 			constrainToContainer="true"
> 			hasShadow="true"
> 			resizable="true" 
> 			windowState="normal";
> 			displayCloseAction="false";
> 			displayMinimizeAction="true"
> 			displayMaximizeAction="false"
> 			executeScripts="true"
> 			toggle="explode"
> 			style="width: 600px; position: absolute; height:
> 200px; left: 100px; top: 150px; display: none"
> 		>
> 				O_o
> 		</div>
> 	</f:verbatim>
> 
> 
> And /site/option.jsf
> 
> 
> <f:verbatim>
> 
> 
> <script type="text/javascript">
> 
>     var x = new dojo.io.FormBind({
>       
>       formNode: dojo.byId("floatform"),
>   	
>       load: function(load, data, e) {
>         var myPanel1 = dojo.widget.byId("paneChoix");
>         myPanel1.setContent(data);
>       }
>   });
> 
> </script>
> 
> 
> </f:verbatim>
> 
> </head>
> <body>
> 
> 
> 	<h:form id="floatform" >
> 	(...)
> 
> 
> In the attach file : the little html static exemple (dojo files not
> include).
> Start with min.html
> Comment or delete the <!-- in form.html and that works..
> 
> Thanks,
> Igor
> 
> 
> 
> -----Message d'origine-----
> De :  Werner Punz
> Envoyé : vendredi 15 septembre 2006 12:30
> À : users@myfaces.apache.org
> Objet : Re: myfaces + dojo = Error running scripts from content:[object
> Error].
> 
> Igor devor schrieb:
>>  Hi,
>>
>> 	I use IE6. and i have a dojo floatpanel (option
>> executeScripts="true") that load a page with javascript and evaluate it.
>> 	With firefox no problem.
>> 	With IE6 i have this error when the floatpanel eval the page.
>> 	And with some static html i have reproduce the error, when a float 
>> pane evaluate a javascript with this
>>
>> <script type="text/javascript">
>> <!--
>> //-->
>> </script>
>>
> Ok... the script itself is initialized in a standardized manner, I assume
> something else is at fault.
> 
> Do you use the dojo tag facilities? If yes, move them over to programmatic
> javascript initialization.
> 
> We had several issues with dojo tag faclities in the past and hence have
> moved our own dojo component code to pure programmatic javascript
> initialisation.
> 
> I dont have a floating pane initialisation code handy, but this one comes
> close:
> 
> http://example.irian.at/example-sandbox-20060915/fisheye.jsf
> 
> check out the sources
> 
> the float pane should be something alike
> 
> var newWidget =
> dojo.widget.createWidget("FloatingPane",{id="componentid"},
> dojo.byId("originaldiv"));
> 
> 
> Which dojo version do you use?
> 
> 


RE: myfaces + dojo = Error running scripts from content:[object Error].

Posted by Igor devor <de...@exotismes.com>.
Hi,

	Well, how can i customise somthing to delete <!-- or add // in the
response.
	

Thanks,
Igor 

-----Message d'origine-----
De : Igor devor
Envoyé : vendredi 15 septembre 2006 14:57
À : 'MyFaces Discussion'
Objet : RE: myfaces + dojo = Error running scripts from content:[object
Error].


I use dojo-0.3.1-ajax.zip
I do not use any tag. It's initialize like this :
	<f:verbatim escape="false">
		<script type="text/javascript">
			var djConfig = {isDebug: true };
		</script>
		<script type="text/javascript"
src="/site/dojo/dojo.js"></script>
		
		<script language="JavaScript" type="text/javascript">
			dojo.require("dojo.widget.*");
			dojo.require("dojo.widget.LayoutContainer");
			dojo.require("dojo.widget.FloatingPane");
			dojo.require("dojo.widget.ResizeHandle");
			
			
		function load(aid,id) {
		      var myPanel1 = dojo.widget.byId("paneOption");
	
myPanel1.setUrl("/site/option.jsf?aid="+aid+"&brid="+id);
		      myPanel1.show();
		}

		</script>
		<div dojoType="FloatingPane"
			id="paneOption"
			title="choisissez une option"
	
iconSrc="/site/dojo/demos/widget/images/flatScreen.gif"
			constrainToContainer="true"
			hasShadow="true"
			resizable="true" 
			windowState="normal";
			displayCloseAction="false";
			displayMinimizeAction="true"
			displayMaximizeAction="false"
			executeScripts="true"
			toggle="explode"
			style="width: 600px; position: absolute; height:
200px; left: 100px; top: 150px; display: none"
		>
				O_o
		</div>
	</f:verbatim>


And /site/option.jsf


<f:verbatim>


<script type="text/javascript">

    var x = new dojo.io.FormBind({
      
      formNode: dojo.byId("floatform"),
  	
      load: function(load, data, e) {
        var myPanel1 = dojo.widget.byId("paneChoix");
        myPanel1.setContent(data);
      }
  });

</script>


</f:verbatim>

</head>
<body>


	<h:form id="floatform" >
	(...)


In the attach file : the little html static exemple (dojo files not
include).
Start with min.html
Comment or delete the <!-- in form.html and that works..

Thanks,
Igor



-----Message d'origine-----
De :  Werner Punz
Envoyé : vendredi 15 septembre 2006 12:30 À : users@myfaces.apache.org Objet
: Re: myfaces + dojo = Error running scripts from content:[object Error].

Igor devor schrieb:
>  Hi,
> 
> 	I use IE6. and i have a dojo floatpanel (option
> executeScripts="true") that load a page with javascript and evaluate it.
> 	With firefox no problem.
> 	With IE6 i have this error when the floatpanel eval the page.
> 	And with some static html i have reproduce the error, when a float 
> pane evaluate a javascript with this
> 
> <script type="text/javascript">
> <!--
> //-->
> </script>
> 
Ok... the script itself is initialized in a standardized manner, I assume
something else is at fault.

Do you use the dojo tag facilities? If yes, move them over to programmatic
javascript initialization.

We had several issues with dojo tag faclities in the past and hence have
moved our own dojo component code to pure programmatic javascript
initialisation.

I dont have a floating pane initialisation code handy, but this one comes
close:

http://example.irian.at/example-sandbox-20060915/fisheye.jsf

check out the sources

the float pane should be something alike

var newWidget =
dojo.widget.createWidget("FloatingPane",{id="componentid"},
dojo.byId("originaldiv"));


Which dojo version do you use?




RE: myfaces + dojo = Error running scripts from content:[object Error].

Posted by Igor devor <de...@exotismes.com>.
I use dojo-0.3.1-ajax.zip
I do not use any tag. It's initialize like this :
	<f:verbatim escape="false">
		<script type="text/javascript">
			var djConfig = {isDebug: true };
		</script>
		<script type="text/javascript"
src="/site/dojo/dojo.js"></script>
		
		<script language="JavaScript" type="text/javascript">
			dojo.require("dojo.widget.*");
			dojo.require("dojo.widget.LayoutContainer");
			dojo.require("dojo.widget.FloatingPane");
			dojo.require("dojo.widget.ResizeHandle");
			
			
		function load(aid,id) {
		      var myPanel1 = dojo.widget.byId("paneOption");
	
myPanel1.setUrl("/site/option.jsf?aid="+aid+"&brid="+id);
		      myPanel1.show();
		}

		</script>
		<div dojoType="FloatingPane"
			id="paneOption"
			title="choisissez une option"
	
iconSrc="/site/dojo/demos/widget/images/flatScreen.gif"
			constrainToContainer="true"
			hasShadow="true"
			resizable="true" 
			windowState="normal";
			displayCloseAction="false";
			displayMinimizeAction="true"
			displayMaximizeAction="false"
			executeScripts="true"
			toggle="explode"
			style="width: 600px; position: absolute; height:
200px; left: 100px; top: 150px; display: none"
		>
				O_o
		</div>
	</f:verbatim>


And /site/option.jsf


<f:verbatim>


<script type="text/javascript">

    var x = new dojo.io.FormBind({
      
      formNode: dojo.byId("floatform"),
  	
      load: function(load, data, e) {
        var myPanel1 = dojo.widget.byId("paneChoix");
        myPanel1.setContent(data);
      }
  });

</script>


</f:verbatim>

</head>
<body>


	<h:form id="floatform" >
	(...)


In the attach file : the little html static exemple (dojo files not
include).
Start with min.html
Comment or delete the <!-- in form.html and that works..

Thanks,
Igor



-----Message d'origine-----
De :  Werner Punz
Envoyé : vendredi 15 septembre 2006 12:30
À : users@myfaces.apache.org
Objet : Re: myfaces + dojo = Error running scripts from content:[object
Error].

Igor devor schrieb:
>  Hi,
> 
> 	I use IE6. and i have a dojo floatpanel (option
> executeScripts="true") that load a page with javascript and evaluate it.
> 	With firefox no problem.
> 	With IE6 i have this error when the floatpanel eval the page.
> 	And with some static html i have reproduce the error, when a float 
> pane evaluate a javascript with this
> 
> <script type="text/javascript">
> <!--
> //-->
> </script>
> 
Ok... the script itself is initialized in a standardized manner, I assume
something else is at fault.

Do you use the dojo tag facilities? If yes, move them over to programmatic
javascript initialization.

We had several issues with dojo tag faclities in the past and hence have
moved our own dojo component code to pure programmatic javascript
initialisation.

I dont have a floating pane initialisation code handy, but this one comes
close:

http://example.irian.at/example-sandbox-20060915/fisheye.jsf

check out the sources

the float pane should be something alike

var newWidget =
dojo.widget.createWidget("FloatingPane",{id="componentid"},
dojo.byId("originaldiv"));


Which dojo version do you use?



Re: myfaces + dojo = Error running scripts from content:[object Error].

Posted by Werner Punz <we...@gmx.at>.
Igor devor schrieb:
>  Hi,
> 
> 	I use IE6. and i have a dojo floatpanel (option
> executeScripts="true") that load a page with javascript and evaluate it.
> 	With firefox no problem.
> 	With IE6 i have this error when the floatpanel eval the page.
> 	And with some static html i have reproduce the error, when a float
> pane evaluate a javascript with this
> 
> <script type="text/javascript">
> <!--
> //-->
> </script>
> 
Ok... the script itself is initialized in a standardized manner, I
assume something else is at fault.

Do you use the dojo tag facilities? If yes, move them over to
programmatic javascript initialization.

We had several issues with dojo tag faclities in the past
and hence have moved our own dojo component code to pure programmatic
javascript initialisation.

I dont have a floating pane initialisation code handy, but this one
comes close:

http://example.irian.at/example-sandbox-20060915/fisheye.jsf

check out the sources

the float pane should be something alike

var newWidget =
dojo.widget.createWidget("FloatingPane",{id="componentid"},
dojo.byId("originaldiv"));


Which dojo version do you use?


RE: myfaces + dojo = Error running scripts from content:[object Error].

Posted by Igor devor <de...@exotismes.com>.
 Hi,

	I use IE6. and i have a dojo floatpanel (option
executeScripts="true") that load a page with javascript and evaluate it.
	With firefox no problem.
	With IE6 i have this error when the floatpanel eval the page.
	And with some static html i have reproduce the error, when a float
pane evaluate a javascript with this

<script type="text/javascript">
<!--
//-->
</script>

=>  Error running scripts from content:[object Error]

And with this 
<script type="text/javascript">
//<!--
//-->
</script>	

No error.

I don't realy know if myfaces should change javascript or dojo the
evaluation method.

Thanks for your answer,
Igor

-----Message d'origine-----
De : Werner Punz
Envoyé : vendredi 15 septembre 2006 10:46
À : users@myfaces.apache.org
Objet : Re: myfaces + dojo = Error running scripts from content:[object
Error].

This has nothing to do with dojo,
what IE version are you using, the javascrt initialization as well as the
generated code is perfectly compliant.

html 4.01 transitional, strict:
<script type="text/javascript">
<!--
//-->
</script>

or
<script type="text/javascript">

</script>

xhmtl transitional:
<script type="text/javascript">
<!--
//-->
</script>
or
<script type="text/javascript">
<!--
-->
</script>

xmhtl normal
<script type="text/javascript">
<!--
//-->
</script>
or
<script type="text/javascript">
<![CDATA[
]]>
</script>


I dont know what the situation is, but all current and most last gen
browsers as is are compliant with that, older browser versions may choke on
this (ie4 maybe)




Igor devor schrieb:
> Hi,
>  
>     I have include some dojo in jsf page, an use some ajax.
>     But in internet explorer i have an error after dojo load an page : 
>     Error running scripts from content:[object Error].
>     
>     I serach and i find why :
>  
>     MyFace generate this javascript : 
>  
> <script type="text/javascript"><!--
> function getScrolling() {
>     var x = 0; var y = 0;
>     if (self.pageXOffset || self.pageYOffset) {
>         x = self.pageXOffset;
>         y = self.pageYOffset;
> 
>         (....)
>  
> or this :
>  
> <script type="text/javascript"><!--
> function clear_floatform() {
>   var f = document.forms['floatform'];
>   f.elements['floatform:_link_hidden_'].value='';
>   f.target='';
> }
> (...)
>  
>  
>  And the error happend because the <!-- start tag is not preceded by 
> javascript comment //
> 
> So, how can i change this :
> <script type="text/javascript"><!--
> 
> By :
> <script type="text/javascript">//<!--
>  
> Or perhaps disable javascript generation only for this page.
>  
> Thanks.
> Igor
> 
> 
> 
> 




Re: myfaces + dojo = Error running scripts from content:[object Error].

Posted by Werner Punz <we...@gmx.at>.
This has nothing to do with dojo,
what IE version are you using, the javascrt initialization
as well as the generated code is perfectly compliant.

html 4.01 transitional, strict:
<script type="text/javascript">
<!--
//-->
</script>

or
<script type="text/javascript">

</script>

xhmtl transitional:
<script type="text/javascript">
<!--
//-->
</script>
or
<script type="text/javascript">
<!--
-->
</script>

xmhtl normal
<script type="text/javascript">
<!--
//-->
</script>
or
<script type="text/javascript">
<![CDATA[
]]>
</script>


I dont know what the situation is, but all current and most last gen
browsers as is are compliant with that, older browser versions may choke
on this (ie4 maybe)




Igor devor schrieb:
> Hi,
>  
>     I have include some dojo in jsf page, an use some ajax.
>     But in internet explorer i have an error after dojo load an page : 
>     Error running scripts from content:[object Error].
>     
>     I serach and i find why :
>  
>     MyFace generate this javascript : 
>  
> <script type="text/javascript"><!--
> function getScrolling() {
>     var x = 0; var y = 0;
>     if (self.pageXOffset || self.pageYOffset) {
>         x = self.pageXOffset;
>         y = self.pageYOffset;
> 
>         (....)
>  
> or this :
>  
> <script type="text/javascript"><!--
> function clear_floatform() {
>   var f = document.forms['floatform'];
>   f.elements['floatform:_link_hidden_'].value='';
>   f.target='';
> }
> (...)
>  
>  
>  And the error happend because the <!-- start tag is not preceded by
> javascript comment // 
> 
> So, how can i change this :
> <script type="text/javascript"><!--
> 
> By :
> <script type="text/javascript">//<!--
>  
> Or perhaps disable javascript generation only for this page.
>  
> Thanks.
> Igor
> 
> 
> 
> 


myfaces + dojo = Error running scripts from content:[object Error].

Posted by Igor devor <de...@exotismes.com>.
Hi,
 
    I have include some dojo in jsf page, an use some ajax.
    But in internet explorer i have an error after dojo load an page : 
    Error running scripts from content:[object Error].
    
    I serach and i find why :
 
    MyFace generate this javascript : 
 
<script type="text/javascript"><!--
function getScrolling() {
    var x = 0; var y = 0;
    if (self.pageXOffset || self.pageYOffset) {
        x = self.pageXOffset;
        y = self.pageYOffset;

        (....)
 
or this :
 
<script type="text/javascript"><!--
function clear_floatform() {
  var f = document.forms['floatform'];
  f.elements['floatform:_link_hidden_'].value='';
  f.target='';
}
(...)
 
 
 And the error happend because the <!-- start tag is not preceded by
javascript comment // 

So, how can i change this :
<script type="text/javascript"><!--

By :
<script type="text/javascript">//<!--
 
Or perhaps disable javascript generation only for this page.
 
Thanks.
Igor