Bullschmidt.com


     Home
     Web Database Concept
     How We Work Together
     Bio
     Web Database Sample
     Classic ASP Design Tips
     Bar Chart Tool
     Web Design Resources
     Access Database Sample

Classic ASP Design Tips
Post Back Page
These are opinions of J. Paul Schmidt, MBA.
No warranties are either expressed or implied.
To Use Paul's Services: Paul@Bullschmidt.com

Many Web pages "post back" to themselves and then handle further processing from there.  This can often cut down on the number of pages that need to be developed and the related back-and-forth involved with many pages.

To make the form post back to the same page:
<form id="frmMain" name="frmMain" action="<%= Request.ServerVariables("SCRIPT_NAME") %>" method="post">

And here are some buttons:
<% ' *** btnClose %>
<input type="submit" name="btnClose" value="Close">
<% ' *** btnSave %>
<input type="submit" name="btnSave" value="Save">
<% ' *** btnNew %>
<input type="submit" name="btnNew" value="New">
<% ' *** btnDel %>
<input type="submit" name="btnDel" value="Delete" onclick="return confirm('Are you sure you want to delete this record?');">

To handle processing toward the top of the page:
If Request.Form("btnClose") <> "" Then ' Close btn.
  ' Close.
  Call ClosePg()
Elseif Request.Form("btnSave") <> "" Then ' Save btn.
  ' Set var.
  Call SetVar("frompost")

  ' Save rec.
  Call SaveRec()
Elseif Request.Form("btnNew") <> "" Then ' New btn from this pg.
  ' Set var.
  Call SetVar("new")
Elseif Request.Form("btnDel") <> "" Then ' Del btn.
  ' Set var.
  Call SetVar("frompost")

  ' Del rec.
  Call DelRec()

  ' Set var.
  Call SetVar("new")
Elseif Request.QueryString("CustID") <> "" Then ' CustID from Many pg.
  ' Set var.
  Call SetVar("fromdb")
Elseif Request.QueryString("CustID") = "" Then ' Add btn from MainMenu pg.
  ' Set var.
  Call SetVar("new")
End If

And the ClosePg(), DelRec(), SaveRec(), and SetVar() functions above are custom functions that would still need to be developed.

And to see something like this in action you can do the following:
- Go to www.bullschmidt.com/login.asp (the ASP Web database demo's login page)
- Click the Continue button
- On the Main Menu click the Invoices Edit button
- On the Invoices Edit Search Dialog click the Edit button
- On the Invoices Many page click on any invoice number
- On the Invoices Input page click the Close, Save, Delete, or New button as each of these buttons posts the page back to itself before doing any further processing.  And actually most of the buttons on all the other pages in the ASP Web database demo also use the post-back concept.





To Use Paul's Services:
Paul@Bullschmidt.com

Let's put some data on the Web!
Copyright © 2000-2018
J. Paul Schmidt, MBA
Freelance Web and Database Developer
All Rights Reserved

Privacy Policy