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

x
?
Solved

Is it possible to control whether to reload a page after saving the data on a web page to the database

Posted on 2004-11-16
7
Medium Priority
?
168 Views
Last Modified: 2008-03-10
Typically in a web application, a user can save the data entered on a web page by clicking the SAVE/SUBMIT button whereby the data is saved to the database, while the user can remain to perform further edits on the page.

In terms of the standard request-response sequence with the web browser, does the response always automatically refresh the page (using latest data from the database) ?

Can this sequence be altered such that the page is not automatically reloaded, as a means to minimise traffic from the web server to browser ?

The preferred sequence of control is as follows :-

1) browser sends request to save data to the database via the web server (triggered by the user clicking SAVE/SUBMIT button.

2) while the database transation is in progress, the SAVE/SUBMIT button on the browser should be disabled (to prevent user inadventently initiating excessive database SAVE transactions), and preferreably the web server provides a work in progress indication (eg. hourglass or message) for the browser

3) when the database SAVE transaction has completed, the web server provides a response by removing the work in progress signal on the browser and re-enble the SAVE/SUBMIT button, but not reloading the entire page.

Will such a sequence minimise the traffic between browser & server ? We have remote users on low bandwidth accessing the web applications and we want ot xplore means to reduce data traffic to the browser.

0
Comment
Question by:bkhong
  • 4
  • 3
7 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 12599199
The server has to respond with something.  This could be a simple, small page with a success message an a button to reload the page.  If the page is static and the user is allowing cahing, then the page will get reloaded from cache without have to go back to the server.  if you have a low bandwidth problem you do not want to even think about truing to report progress during database updates.  The only way to do that reliabley is with an open pipe and continuous traffic.

Cd&
0
 

Author Comment

by:bkhong
ID: 12603915
thanx cd&

1) so with the disconnected nature of HTTP, it is not feasible to report progress on DB updates even for an intranet web appl when bandwidth is not an issue ?

2) as for the standard request-response sequence, if we just let the server reloads the (submitted) page, the visual content of the page is the same and the user cannot readily tell if the DB update has completed.
    Also to prevent the user clicking save excessively, is it ok to implement something like what is suggested in the link   //aspzone.com/artiles/207.aspx   and can you pls advise any downside with such an approach ?
   
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 12605098
It is possible even on the internet, but it means you have to have something to keep sending across to the server for the uspdated status.  An applet, activex control, or scripting in a hidden from.  It would also require additional coding on the server to response to the requests after determining the status on the request activitiy.  the lag time means it would not be particularly accurate.  Generally when such status reporting is considered it is because there is a prformance problem, and any method used is going to make the response time even worse so it is not something commonly don with web clients, even for intranet apps.

The only problem I see with the disabling approach is if you have a lot of form validation to do, then disabling could get in the way.  As for the page coming back;  you have control of what gets sent as a response. Just put a message on the page that indicates whether or not the update was successful.

This is really a very straight forward operation it is done millions of times every day.  There is no gain in looking for ways to turn it into something complicated.  The server gets the form; The form is parsed and the database is updated; a response gets generated based on the result; the page gets sent back to the client. Millions of times every day that happens on all kinds of sites including this one. Am I missing something that reequires som additional level of complexity?

Cd&
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

Author Comment

by:bkhong
ID: 12613814
thanx cd&.

You're right, I was too ambitious to look for a solution that :-

1) can stop a user clicking excessive saves while waiting for respsone in a low bandwidth situation
2) in the meantime keeping the user informed that work is in progress

the disabling is sort of an approach but as you point out with some complications. Agree that your suggestion of using the standard approach of adding a message to the returned page will suffice.

As you can see, I'm very green in this and just appreciate another couple of  expert advice and I'll close the call :-

1) as a matter of interest, the disabling approach is directed at the one button, and appeared to me as client script (javascript ?), how come it adversely affects the rest of form validations

2) to implement a simple alert for a user who attempts to navigate away from a web page after updates but forget to save them, is that mainly under client side or server side control



0
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 2000 total points
ID: 12615141
1) Normally if you have client side validations that fail it would require re-entry by the user and the form would not get submitted until they correct the data and re-submit.  A disable submit buton would prevent them from doing that so the validation code requires additional coding to re-enable the disabled submit.  Depending on oncomplex the validations are, and how well written the routines are, it could be a lot or a little code to incorproate the disabling functionality.

2) It is strictly client side.  There is no way for the server to detect that the user has left the site.  On the client you can attempt to fire a beforeunload event to alert the user but it is unreliable, and will irritate most users:

Before exiting you can do this!   IE only!!!

window.onbeforeunload=afunction;  //notice no arguments

function afunction()
{
  // statements you want to execute
  return "message";    //if a text string is returned it will be used
}                      //for a dialog box

The event cannot be trigger from an HTML tag, the event
call has to go in the HEAD of the document

I do not recommend this.  It is non-standard, unreliable, browser specific, ans subject to change by Microslop without notice.

Cd&
0
 

Author Comment

by:bkhong
ID: 12621455
thanx very much cd& for your expert advice to educate me,

appreciate your microslop humour, we here refer to it as M$

0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 12626166
Glad I could help.  Thanks for the A. :^)

Cd&
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
Following on from our article on "The Murky World of Consent and opt in", we thought we would issue some helpful guidance, not only on consent itself but knowing what information you are capturing, what you are doing with this data and how you can p…
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…

581 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