ASP programming design

Results 1 to 3 of 3

Thread: ASP programming design

  1. #1
    Jon Guest

    Default ASP programming design

    Is it possible to call a VBS sub from ASP code on &#039;unload&#039;?<BR><BR>It seems customary to do all the VB processing first, or as much as possible with some of it also done during the page rendering, but I&#039;d like the page to save data prior to the next http request (such as jumping out of the website). The &#060;body&#062; tag can reference an onunload javascript function, but I want to use ADO and run the exit code before leaving the page. I want to avoid the "Click this button to update quantities" on the shopping cart. It seems that this must be done on loading the next page, typically reloading the same one with a hidden form variable indicating which state it is going to, which is used to branch to the appropriate preprocessing and rendering subs on reloading. <BR><BR>Is this the best way of designing ASP page code?<BR><BR>Is it okay to call whatever GetData subs are needed from the main, then render the opening html (&#060;html&#062; thru &#060;body&#062;, including javascript code and include files) in a ShowHeader sub, then call various optional ShowDataSection rendering subs to choose from, and then to finish with a ShowFooter sub (that just has &#060;/body&#062;&#060;/html&#062; plus whatever stock html code needs to go above it)? <BR><BR>I guess Remote Scripting is an option, but have had problems with NN 4 compatibility.

  2. #2
    Join Date
    Dec 1969

    Default Redirect to asp...

    In the unload event (if there is one) use javascript to redirect the browser to an ASP page that saves your data. Your user won&#039;t like this but, if its what you want to do, you can do it that way ;)<BR><BR>BTW you *should* have your data saved BEFORE the page is rendered. ASP processes before the page is even sent to the browser.<BR><BR>-- Whol

  3. #3
    Jon Guest

    Default RE: Redirect to asp...

    So if I wanted to force a save of any changed data, I could have a javascript exit routine that (on detection of data change) saves the newly-requested URL (not sure how to access this but suspect it can be done) in a hidden form variable, then redirect to the same page with a hidden form variable set to indicate doing the exit sub without any page rendering, and then proceed to the requested URL. I guess the problem is that it would be called even if the user clicks a regular submit button to proceed to the next step.<BR><BR>I can see how a better solution is to have all valid on-site pages check if it came from the "Shopping Cart" page (e.g.) and then do the save of the form vars into the database using a VBS sub and ADO.<BR><BR>--Jon

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts