Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Progress bar / percentage for HTML form submission

Posted on 2005-04-08
6
Medium Priority
?
308 Views
Last Modified: 2008-03-17
Hi,

I am submitting textarea content via HTML form to a server side script. The contents of the text area somtimes contains binary content (content from a client side file editor)
Sometimes the content reaches a size of 500k+

Submitting this size of data in a form takes quiet a while.
What is the best way of displaying some sort of progress to the user?

Perhaps there is a javascript method to see the bytes sent, or something similar?

Thanks.
0
Comment
Question by:richardoc
  • 2
4 Comments
 
LVL 5

Expert Comment

by:apparition
ID: 13737427
You are better off modifying your server side script to do the progressbar. What language is the server side script using - depending on that you will be able to find sample code on various sites.

If are unable to modify the script then can fake the progress bar by using an animated gif. Once your users click submit display the animated gif.
0
 

Author Comment

by:richardoc
ID: 13737520
The server-side code is written in ASP.

Don't think a fake gif is 'going to achieve ny aims' :)
0
 
LVL 5

Accepted Solution

by:
apparition earned 1000 total points
ID: 13737560
Try this tutorial :

Creating a Progress Bar for use in ASP
http://www.webconcerns.co.uk/javascript/progressbar/progressbar.asp
0
 
LVL 29

Assisted Solution

by:rdivilbiss
rdivilbiss earned 1000 total points
ID: 13740303
Here is an example using Server.Transfer in ASP.

http://www.rodsdot.com/ee/progess_bar_form_handler.asp

Basically, we move your form processing code below an HTML output.  When the processing is complete, we use server transfer to go to execute the processed OK or processed Error pages, which erase the progess bar and display the appropriate results.

If your form data processing code can report its progress, then you can use the same method to replace the progress bar with a progress complete message.  (You might need to use Server.Execute in that case, so you do not permanently transfer control away from your form handling page.)

If your form data processing code can NOT report its progress, then stick with the example.

----------------------------------------- form handling page ---------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!-- http://www.experts-exchange.com/Web/Q_21381513.html -->
<html>

<head>
<meta name="author" content="Roderick Divilbiss">
<meta name="copyright" content="© 2005 Roderick Divilbiss">
<title>Progess Bar Form Handler</title>
</head>

<body id="oBody">
Please Wait While Your Data Is Submitted.<br>
<img border="0" src="progressBar.gif" width="349" height="21">
</body>

</html>
<%
' force the progress bar to be written before the form handling code starts.
response.flush

Dim processedOK
processedOK = false


'**************************************
'* Process you form data here
'**************************************
' simulated.
Dim idx, i
for idx = 1 to 10000000
      i = i + idx
next
'* pretend success
processedOK = true
'***************************************


if processedOK then
      server.transfer("progess_bar_finished.asp")
else
      server.transfer("progess_bar_error.asp")
end if      
%>
--------------------------------------------------------------------------------------------------------------

----------------------------------------- form success page - progess_bar_finished.asp ---------------
<script language="javascript" type="text/javascript">
<!--
document.getElementById('oBody').innerHTML='Thank you for waiting.<p>Your data was submitted successfully.</p>';
//-->
</script>
--------------------------------------------------------------------------------------------------------------

----------------------------------------- form handling page - progess_bar_error.asp -----------------
<script language="javascript" type="text/javascript">
<!--
document.getElementById('oBody').innerHTML='There was an error processing your data.<p>Please try again later.</p>';
//-->
</script>
--------------------------------------------------------------------------------------------------------------
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Suggested Courses
Course of the Month13 days, 11 hours left to enroll

580 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