Solved

processing image on form submit

Posted on 2014-01-15
4
410 Views
Last Modified: 2014-01-16
Hello,

I need to show processing image on the page after the submit button is pressed.
I have an image on which i am calling java script function to submit the page.(document.form.submit)

Since there are around 7-8 tables in which the entries are inserted/updated which takes around 15-20 seconds.

Pages X -> document.form.submit -> Page Y.

Q1 -> How to show the processing message since the form is submitted and request is sent to server side.
Q2 -> How the X page comes to know that the processing image should hide?

Please suggest?
0
Comment
Question by:Rocking
  • 2
  • 2
4 Comments
 
LVL 27

Assisted Solution

by:rrz
rrz earned 500 total points
ID: 39782856
0
 

Author Comment

by:Rocking
ID: 39782930
If the document.from.submit is called then the request goes to the server side and server side processing starts.

I just can't understand then how can the code which is written after the from submit works?
0
 
LVL 27

Accepted Solution

by:
rrz earned 500 total points
ID: 39783595
>I just can't understand then how can the code which is written after the from submit works?
I am not sure. Let's use some test code. I am testing with the IE11 browser.
<html>
<head>
<title>FormTest</title>
   <style>
       .hidden { display: none; }
       .unhidden { display: block;}
   </style>
<script>
function submitForm(){
    var submitTime	= new Date().getTime();
	document.getElementById("submitTime").innerHTML = "submitted at " + submitTime;
	document.dataForm.submit();
    var submitImage = document.getElementById("submitImage");
    submitImage.className = 'hidden';
    var wait = document.getElementById("waitHTML");
    wait.className = 'unhidden';
	var returnTime	= new Date().getTime();
	document.getElementById("returnTime").innerHTML = "function return at " + returnTime;
}
</script>
</head>
<body>
<form name="dataForm"  method="post" action="result.jsp">
  <input type="text" name="firstName">
  <input type="text" name="lastName">
</form>
<div id="submitImage"> 
    <p><a  onclick="submitForm();">Submit</a></p>
</div>
<div id="waitHTML" class="hidden">
    Please wait until the process is complete.
	<div id="submitTime">   </div>
	<div id="returnTime">   </div>
</div>

</body>
</html>

Open in new window

and result.jsp is
<%@ page import="java.util.Date" %>
<html>
<body>
Request received at<%=new Date().getTime()%><br/>
<%
Thread.sleep(10000);  //mock processing
  out.print("Here is result");
%>
</body>
</html>

Open in new window

0
 

Author Comment

by:Rocking
ID: 39785783
the code is working,thanks
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Oracle SQL syntax check  without executing 6 100
java example issue 5 42
Bot application - advice 3 58
Html split(text) 2 26
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question