Javascripts not loaded - Seperate Deployment

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Javascripts not loaded - Seperate Deployment

Vedha
Hello,

We are trying to implement Orbeon XForms in our project which is in AngularJS application. We are trying to use separate deployment. We followed the instruction given in the below link,

http://wiki.orbeon.com/forms/doc/developer-guide/xforms-with-java-applications

Everything work correctly other than one issue that the Javascript are not getting executed after the page is loaded in Browser. Since ours is angular JS application we could not do anything.

I created the same scenario in below sample. Here also javascript code is not getting called after page is loaded. I am loading for an alert after page is displayed.

Web.xml

---------------------

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>OrbeonTest</display-name>
 
  <servlet>
   <servlet-name>ApplicationServlet</servlet-name>
   <servlet-class>ApplicationServlet</servlet-class>
</servlet>

<servlet-mapping>
   <servlet-name>ApplicationServlet</servlet-name>
   <url-pattern>/ApplicationServlet</url-pattern>
</servlet-mapping>


  <filter>
    <filter-name>orbeon-xforms-filter</filter-name>
    <filter-class>org.orbeon.oxf.servlet.OrbeonXFormsFilter</filter-class>
    <init-param>
      <param-name>oxf.xforms.renderer.context</param-name>
      <param-value>/orbeon</param-value>
    </init-param>
    <init-param>
      <param-name>oxf.xforms.renderer.default-encoding</param-name>
      <param-value>UTF-8</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>orbeon-xforms-filter</filter-name>
    <url-pattern>/xforms-jsp/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
  </filter-mapping>
  <filter-mapping>
    <filter-name>orbeon-xforms-filter</filter-name>
    <url-pattern>/orbeon/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
  </filter-mapping>
  <session-config>
    <session-timeout>240</session-timeout>
  </session-config>
</web-app>

*.xhtml file
-----------------------------------
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:mdl="http://inetprogram.org/projects/MDL" xmlns:zds="http://www.zds-fr.com/zds" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xxf="http://orbeon.org/oxf/xml/xforms" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<head>
<title>Guess The Number</title>
<xf:model>
        <xf:instance id="mdl">
........................
        </xf:instance>
</xf:model>
<script type="text/javascript"> window.onload = function(){ alert("Loading"));} alert("Loading")); $(document).ready(function(){ alert('Loading'); }); </script></head>
<body class="orbeon">
       

My Page

        <xf:input ref="instance('mdl')/user-id" />
       
       
UI code
                   
                    </xf:group>
            </xf:repeat>
        </xf:group>
</body>
</html>


When i run this file on a server, Orbeon post processes it correctly, but after it loads on browser , i am not seeing any alert (which i gave in my javascript).




Reply | Threaded
Open this post in threaded view
|

Re: Javascripts not loaded - Seperate Deployment

Alessandro  Vernet
Administrator
Hi Vedha,

When you say that "Javascript are not getting executed", which JavaScript are you referring to? Orbeon's JavaScript, or your own? Am I right to believe that from your example, you're referring to your own JavaScript not running?

This should be reproducible with a single file, shouldn't it? Would you be able to share with us such a file, so we can quickly see the problem you're referring to?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Javascripts not loaded - Seperate Deployment

Vedha
This post was updated on .
Thank you for your reply. Here are the files.constraints.xhtml

Yes we are referring to our javascripts. In this sample, i have added Javascript alert messages and non of them are displayed.

What am i missing?
Reply | Threaded
Open this post in threaded view
|

Re: Javascripts not loaded - Seperate Deployment

Alessandro  Vernet
Administrator
Hi Vedha,

When I loaded this example, in the Chrome console, I saw:
Uncaught SyntaxError: Unexpected token )

Removing 2 extraneous ")" in the JavaScript, the alert worked. Could you try with this updated version of the file: constraints.jsp. Is it working for you as well?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet