Solved

processing image on form submit

Posted on 2014-01-15
4
394 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
Comment Utility
0
 

Author Comment

by:Rocking
Comment Utility
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
Comment Utility
>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
Comment Utility
the code is working,thanks
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This video teaches viewers about errors in exception handling.

763 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

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now