|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Just Starting Out - need suggestions on what tools to use
Now, I'm only a beginner at ASP. I find myself having to make some order forms that would be fairly basic if it weren't for the fact that there are a lot of items, and consequently lots of variables to keep track of. I was wondering if there's some sort of utility that scans forms and compiles a list of variables in it into a text file, or even better that can take said list and preform certain actions with it, like putting them all in hidden fields, or into the variable_name = Request.form("variable_name") thing (don't know what that step's called, but apparently it's needed to take variables over from one asp file to another?). A program with features like these would save me plenty time.
Anyway if someone can help me here, I'd really appreciate it. |
|
#2
|
||||
|
||||
|
If you have a form with a lot a fields (any number actually), there's a few methods you can use to make your life very simple indeed. The one i use is:
Name all your fields the same as their name in the DB Prefix the form fields with some kind of identifier. I use "txt_" The ASP page that you then post to just has to do a request.form() - then loop thru all the form elements beginning with "txt_". Build your SQL strings as you go, then just stick them onto an INSERT or UPDATE statement, along w/ the corresponding table information, and your done. Note that above "tool" takes a bit of time and thinking to write, BUT, this one script can be used by EVERY SINGLE SITE you do from now on! It will save you HOURS of coding! |
|
#3
|
|||
|
|||
|
On the receiving end you can iterate the request form collection using for each like code below
<%for Each ElemName in Request.form%> <input type="hidden" name="<%=ElemName%>" value="<%=request.form(ElemName)%>"> <%next%> The code above will list all the request collection in a hidden field... HTH... HAppy programming... |
|
#4
|
||||
|
||||
|
smcortez, where would you use this?
If looks like it just recreates the form and makes all fields hidden. Iterating thru the is a good method too. It's a good idea to name your form fields with an identifier (e.g. txt_foo) so that when iterating thru the form, it's easy to pick out the useful fields, so you don't collect things like button names and co-ords of submit clicks... and any other junk from the form. |
|
#5
|
|||
|
|||
|
@stumpy,
<<<< where would you use this <<<< this will come in handy when you have a confirmation page wherein the user will check first if all entries are correct... Basically you need to put it in a form and on the press aof a button you will submit to be send to the db... As well as to edit the entries... As you can see the original is being rewritten but it is being put in a hidden field... This will make your coding much more easier... HAppy programming... |
|
#6
|
||||
|
||||
|
sounds interesting - i'll give it go!
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > ASP Development > Just Starting Out - need suggestions on what tools to use |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|