• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Tim Cooke
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
Saloon Keepers:
  • Piet Souris
Bartenders:

java script error help please

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I run the following jsp to automaticcally refresh every 10 seconds i'm geting javascript error that object is null on line document.refreshForm.submit(). can you please help on sloving the issue.
I double checked the stuts file and action and form path has been defined.

<%@ page import='java.util.*' %>

<%@ page import='presentation.action.RefreshTimer' %>

<%@page import='presentation.action.RefreshAction'%>

<%@page import='presentation.form.RefreshForm'%>

<script language="javascript" >

var temp = window.setInterval('submitPage()',10*1000);


function submitPage(){


alert("before count submit");

document.refreshForm.submit();

var xyz = <%=application.getAttribute("counter")%>

alert("New Request is " + xyz);

}

</script>




<html:form action="/refresh.do" method="post" onsubmit ="submitPage()">


</html:form>
 
Sheriff
Posts: 67762
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moved to the HTML/Javascript forum.
 
Bear Bibeault
Sheriff
Posts: 67762
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where is refreshForm defined?
 
Makhana Jiggu
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bear,
RefreshForm is deifned in the struts file of the action path(refresh.do) and form bean
<form bean name ="refreshForm" path="presentation.form.RefreshForm">
 
Bear Bibeault
Sheriff
Posts: 67762
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is not in your above example.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The form name is defined in sturts config file of that particluar action which is refresh.do

Even if i declare the form name as myform when i call the jsp page it gives me an error that document.myForm is not an object or is null. How can i resolve this.
 
Bear Bibeault
Sheriff
Posts: 67762
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In order for the reference document.refreshForm to resolve to an actual element, there has to be a form element with that name defined on the page. Until there is, you are going to continue to get the error.

What are you trying to accomplish by submitting a form that does not exist on the page?
 
bujji makani
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bear,

I defined on the form page as follows:
<html:form name ="refreshForm" action="/refresh.do" method="post" type ="presentation.form.RefreshForm">

This does not work so I created a hidden element but did not work either.
<input type="hidden" name="refreshForm" value="count" />

I want to submit the form to the server to get new values from database.
how can i submit this form from jsp page to the server without using submit buttons.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You already posted the code above to do it.

Eric
 
Bear Bibeault
Sheriff
Posts: 67762
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

This does not work



This is not useful information that will help diagnose the problem. How does it not work?


This does not work so I created a hidden element but did not work either.



Stabbing in the dark is rarely effective.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

document.refreshForm.submit();



<input type="hidden" name="refreshForm" value="count" />



As Bear pointed out, refreshForm needs to be a form, you can't define it as an input element.
[ January 30, 2006: Message edited by: Ulf Dittmer ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic