5 Replies Latest reply on May 22, 2007 4:58 PM by cliffwiggs

    javascript error on first page load using Ajax

    cliffwiggs

      I have several ajax issues, but I think they might all be resolved by fixing the first one. I'm hoping this is just a setup issue.

      I'm using Eclipse 3.2.1 with ExadelStudioPro 4.0.4a (and the Tomcat that comes default with it) and RichFaces 3.0

      There are 2 controls on my page that use ajax and both have this behavior. One is a simple selectOneMenu with a4j:support and the other is a rich:datascroller. the selectOneMenu filters the data for the datatable supported by the datascroller. The backing bean is session scoped and all members are given a value in the constructor.

      I open a new browser and type in the URL of the page. All controls on the page load correctly. If I click on either of my ajax enabled controls, the a4j:status indicates that ajax communication has started and then IE reports a javascript error:
      Line: 46
      Character: 212
      Error: Object doesn't support this property or method
      Code: 0

      I have no javascript in my page, so this must be the a4j or richfaces generated javascript. The a4j:status halts showing it is processing(but of course its stopped with the error). There are no exceptions reported via the server.

      If I now 'refresh' the browser, the selectOneMenu has the value I had selected, so the bean is being updated.

      Here is the strange thing...

      If I open my browser and type the URL in directly (exactly as before), and then immediately hit f5 to refresh the page. Then the ajax code will show processing and then complete. The selectOneMenu works correctly and the datatable shows the updated recordset. The datascroller initally doesn't work, but after selecting several values from the selectOneMenu control it will start working, but thats a seperate issue.

      I have viewed the generated source through IE from the page before the first refresh and after the refresh and they differ only slightly.

      For example, before the refresh (the one that has an error) it generates:

      <form id="helloForm" method="post" action="/DDOnline/pages/inputname.jsf;jsessionid=735AAB7340E4CA0D579F15513B7EE4EB" enctype="application/x-www-form-urlencoded">


      After the first refresh it generates:
      <form id="helloForm" method="post" action="/DDOnline/pages/inputname.jsf" enctype="application/x-www-form-urlencoded">


      Do I just have some type of initalization error when the bean is created?
      What additional info do you need?