0
Dynamic input fields base on a value
New Here
,
/t5/coldfusion-discussions/dynamic-input-fields-base-on-a-value/td-p/883929
Oct 14, 2008
Oct 14, 2008
Copy link to clipboard
Copied
I have a form that auto generates a document number. The user
then enters one or more part numbers and quantities. When they
submit, I insert all the document number, all the part nubmers and
quantites into a table. I then use cflocation to pass the document
nubmer to another page and query the table again using
#url.docuemnt_number#.
What I want to do is to generate input fields based on the quantity of each part number. So if I retrieve pn1 for the docuemtn number and the qty is 5, it will generate 5 input fields. Then it gets the next part number, pn2, and if the qty is 2, it will generarte 2 input fields, etc. all on the same page. When they submit, I will insert all the input fields into another table along with the docuemtn number and part number.
Is is possible to do this in cf, and if yes, how do I do it.?
What I want to do is to generate input fields based on the quantity of each part number. So if I retrieve pn1 for the docuemtn number and the qty is 5, it will generate 5 input fields. Then it gets the next part number, pn2, and if the qty is 2, it will generarte 2 input fields, etc. all on the same page. When they submit, I will insert all the input fields into another table along with the docuemtn number and part number.
Is is possible to do this in cf, and if yes, how do I do it.?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Engaged
,
/t5/coldfusion-discussions/dynamic-input-fields-base-on-a-value/m-p/883930#M81332
Oct 15, 2008
Oct 15, 2008
Copy link to clipboard
Copied
Hi,
Well, yes it is possible. But I think I would change things a bit in your logic. It seems odd to store the document number, part number and quantity in the database after the user has hit submit. Why do you need to insert those values into the database at this point? You shouldn't have to query the table again using #url.document_number#.
Page 1: Have a form where the user enters one or more part numbers and quantities. When the user submits the form pass the data to page 2
Page 2: Receives the data from the user and ColdFusion makes it available in the Form Scope on the calling page (page 2). I would then just loop the number of times for each given part number's quantity. At each iteration of the loop a new <input type="text" /> field gets created
There are also other ways to do this so maybe someone else can chime in.
Hope that at least get you started, but the key is to loop. If you have a qty of 5 for a given part number and you want 5 input fields, you should loop.
-Westside
Well, yes it is possible. But I think I would change things a bit in your logic. It seems odd to store the document number, part number and quantity in the database after the user has hit submit. Why do you need to insert those values into the database at this point? You shouldn't have to query the table again using #url.document_number#.
Page 1: Have a form where the user enters one or more part numbers and quantities. When the user submits the form pass the data to page 2
Page 2: Receives the data from the user and ColdFusion makes it available in the Form Scope on the calling page (page 2). I would then just loop the number of times for each given part number's quantity. At each iteration of the loop a new <input type="text" /> field gets created
There are also other ways to do this so maybe someone else can chime in.
Hope that at least get you started, but the key is to loop. If you have a qty of 5 for a given part number and you want 5 input fields, you should loop.
-Westside
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Olivia_Crazy_Horse
AUTHOR
New Here
,
LATEST
/t5/coldfusion-discussions/dynamic-input-fields-base-on-a-value/m-p/883931#M81333
Oct 15, 2008
Oct 15, 2008
Copy link to clipboard
Copied
Thanks for the response.
I thought about passing instead of inserting in the first screen, but how do you pass all those values, multiple part numbers and quantities ? Thats why I inserted first.
Also for the loop, it would be cfloop from=1 to =#qty# ? How or when does the qty change based on each part number ?
I thought about passing instead of inserting in the first screen, but how do you pass all those values, multiple part numbers and quantities ? Thats why I inserted first.
Also for the loop, it would be cfloop from=1 to =#qty# ? How or when does the qty change based on each part number ?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

