![]() |
|
|
This tip comes from Anton B. Throughout many of my applications, I find myself checking at the top of every page whether the user has input the value(s) needed for the processing of the page. That is mostly to make sure the user has reached the page through the designated form and not by browsing his/her history, and to also avoid the page spitting an ODBC error.
The logic behind it is quite simple, check for the specified QueryString variable, if it is not there then use
In one of my applications, I found the practice quite time consuming, and realized that most of my pages were
expecting one variable. Being as lazy as I am, I decided to make the process generic throughout the application,
so I added a table that I called
Alongside the table goes a generic prompt page that receives the ID of the form to be displayed and constructs itself accordingly. Here's the code to a skeleton page:
Now whenever I need to check for input values on a page, it's enough to create an entry in my table and call
it from that page. Here's an example of a page called
The values in my table would be like: ID : 1 'autonumberfrmAction : foo.aspfrmMethod : GETfrmTitle : Enter Customer IDfrmText : You have not provided a Customer ID, please enter one and hit the buttonfrmFieldName : CustomerIDfrmButtonText : enter
The page turned out so useful I am even using it as a primary data gathering page rather than a fail safe system. Currently the page only displays one Text Box. I will be working on multiple input fields per page and extending the input types to possibly include Radio Buttons and Check Boxes. Stay tuned and happy programming. Happy Programming!
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|