473,406 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

form elements created by not posting

hey.
Im creating a basic function to submit product skus and quantities to another page
i am created the form elements for the quantities in a popup div based on items selected on the current page.

I am looping round those, and creating an input field for each
i need each input field to be submitted with the post of the main form on the page

here is my function
for some reason even thought the input fields are being appended to a div inside the main form... they are not submitted when the form is posted.

Thanks for you help.
Rob

Expand|Select|Wrap|Line Numbers
  1. function addToPackage()
  2. {    
  3.     var items = document.itemlist.item_id;
  4.     var checkeditems = 0;
  5.     var itemsku;
  6.  
  7.     var itemQtyDiv;
  8.     var itemQtyInput;
  9.     var itemQtyLabel;
  10.     var itemQtyText;
  11.  
  12.     editQtyLayer = document.getElementById('packageqtychoice');    
  13.  
  14.     for(i=0;i<items.length;i++)
  15.     {
  16.         if(items[i].checked)
  17.         {
  18.             checkeditems++;
  19.  
  20.             itemsku = items[i].value;
  21.  
  22.             //add the div section for this sku
  23.             itemQtyDiv = document.createElement("div");
  24.             itemQtyDiv.setAttribute("id", "item_container_"+itemsku);
  25.             editQtyLayer.appendChild(itemQtyDiv);
  26.             itemQtyDiv = document.getElementById('item_container_'+itemsku);
  27.  
  28.             //add the label for the text
  29.             itemQtyLabel = document.createElement("label");
  30.             itemQtyLabel.setAttribute("id", "item_label_"+itemsku);
  31.             itemQtyLabel.setAttribute("for", "item_qty_"+itemsku);
  32.             itemQtyDiv.appendChild(itemQtyLabel);
  33.  
  34.             //create text node        
  35.             itemdescription = document.getElementById('item_description_'+itemsku).innerHTML;
  36.             itemQtyText = document.createTextNode(itemdescription);
  37.  
  38.             //add the text to the label
  39.             itemQtyLabel = document.getElementById('item_label_'+itemsku);
  40.             itemQtyLabel.appendChild(itemQtyText);
  41.  
  42.             //finally create the qty input
  43.             itemQtyInput = document.createElement("input");
  44.             itemQtyInput.setAttribute("type", "text");
  45.             itemQtyInput.setAttribute("size", "2");
  46.             itemQtyInput.setAttribute("name", "item_qty_"+itemsku);
  47.             itemQtyInput.setAttribute("id", "item_qty_"+itemsku);
  48.             itemQtyInput.setAttribute("value", "");
  49.             itemQtyDiv.appendChild(itemQtyInput);
  50.  
  51.         }
  52.     }
  53.  
  54.     if(checkeditems>0)
  55.     {
  56.         editQtyLayer.innerHTML = '<a href="javascript:void(0);" onclick="__cancelToPackage();">Cancel</a><br /><b>Enter Quantities included in package</b>'+editQtyLayer.innerHTML;
  57.         editQtyLayer.innerHTML = editQtyLayer.innerHTML+'<br /><br /><a href="javascript:void(0);" onclick="__sendToPackage(); return false;"><b>Proceed to choose a package</b></a>';
  58.         editQtyLayer.style.display='block';
  59.     }
  60.     else
  61.     {
  62.         alert('You have not chosen any items');
  63.     }
  64. }
  65.  
  66.  
Apr 13 '07 #1
1 1554
acoder
16,027 Expert Mod 8TB
This link should help anyone with a similar problem.
Feb 5 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div...
1
by: Jeremy Langworthy | last post by:
Hi I have a dynamicly generated form (well the elements are at least) that looks something like this: while( not end of returned records): <input name="plan_id" type="checkbox" id=""...
1
by: Will | last post by:
Hi, I have a problem trying to validate dynamically created html form elements using javascript. I have dynamically created a check box using ASP for each record in a recordset and have given each...
2
by: Mark Hannon | last post by:
I am trying to wrap my brain around storing form elements inside variables & arrays before I move on to a more complicated project. I created this simple example to experiment and as far as I can...
7
by: Venus | last post by:
Hello, I am trying to generate a dynamic form at runtime and would like to do it using "<asp: ..." form elements as follows Build up the string that is placed somewhere in the HTML code the...
6
by: Vikram | last post by:
I have added some input elements on a page using javascript at client side. when i submit the page, i am unable to access the values of input elements created using request.form. Are elements...
4
by: Walton | last post by:
checkout: (3rd paragraph under 'Remarks' section) http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/properties/name_2.asp from the page: "The NAME attribute...
3
by: MitchellEr | last post by:
Hi, I am in the process of creating several forms where a group of elements on the form need to be created dynamically. For example, in the case of one of the forms, I have a drop down for...
2
by: gubbachchi | last post by:
Hi, I have a form whose elements are created dynamically on selection, i.e. the form has only text boxes and the number of text boxes depends on the users selection, if user selects 3 then 3...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.