|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Dynamic form fields
I am currently working on an inventory ordering system where there could be a large amount of inventory items to order, the client would like a way that he could view a list of the inventory items and have a input box beside each one and place the amount he would like to order this box rather then click on a link and enter the amount one item at a time.
So it would look something like this: item1 [input box] item2 [input box] item3 [input box] And so on The problem I am running into is that I am not sure how to check how much they ordered for each item He doesn’t want any of the fields required and so there is a good chance that a few of the boxes will always be left empty, and with a list of item that could goes into the hundreds I don't want to just do an if statement for each one. Also each item will have to be entered on there own row with a few other static items, in the database (just for reference they are using an access database). After submitting the fallowing items would have to be saved in the database: - item number - user id - current date - total amount ordered for that items Any suggestions would greatly be appreciated. Thank you. |
|
#2
|
|||
|
|||
|
When a form is posted, CF creates a form variable called "fieldNames" which contains a list of all the form fields posted. You can loop over this list, check to see if a value was entered into the text field, and perform your database insert.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#3
|
|||
|
|||
|
Thank you, I have been trying to find out what the name of that variable was for a while.
But how would I go about, getting the value of the text field, when the name of the text field is a variable value, is there a way in coldfusion to have a variable value as a variable name. Thank you |
|
#4
|
|||
|
|||
|
You should be able to do something like this:
<cfloop list="#form.fieldnames#" index="thisField"> Field Name: #thisField#<br> Field Value: #form[thisField]#<hr> </cfloop> |
|
#5
|
|||
|
|||
|
Thank you, That should work for what I need, with out any problems.
Thank you, again |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Dynamic form fields |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|