473,889 Members | 1,651 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

form elements created by not posting

1 New Member
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.

Expand|Select|Wrap|Line Numbers
  1. function addToPackage()
  2. {    
  3.     var items = document.itemlist.item_id;
  4.     var checkeditems = 0;
  5.     var itemsku;
  7.     var itemQtyDiv;
  8.     var itemQtyInput;
  9.     var itemQtyLabel;
  10.     var itemQtyText;
  12.     editQtyLayer = document.getElementById('packageqtychoice');    
  14.     for(i=0;i<items.length;i++)
  15.     {
  16.         if(items[i].checked)
  17.         {
  18.             checkeditems++;
  20.             itemsku = items[i].value;
  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);
  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);
  34.             //create text node        
  35.             itemdescription = document.getElementById('item_description_'+itemsku).innerHTML;
  36.             itemQtyText = document.createTextNode(itemdescription);
  38.             //add the text to the label
  39.             itemQtyLabel = document.getElementById('item_label_'+itemsku);
  40.             itemQtyLabel.appendChild(itemQtyText);
  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);
  51.         }
  52.     }
  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. }
Apr 13 '07 #1
1 1582
16,027 Recognized Expert Moderator MVP
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

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 style="display:none"> can be displayed by setting the style attribute to "display:", or hidden with "display:none". This gives the illusion that the person filling out the form is switching from page to page...without the overhead of extra hits on the server,...
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="" value="<?= $row_plans->planid ?>">
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 a unique ID using the primary key from a db table. e.g "chk" + "1" for record 1 and "chk" + "2" for record 2 etc. This means each box is called chk1 and chk2 respectively. This works fine and changes dependant on the recordset used and allows me...
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 tell, it should work but it doesn't. Can someone tell me where I went wrong? <html><head> <title>Form Test</title> <script language="JavaScript> <!-- function copy(){
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 same way like regular input fields can. strForm = "<form name=""myForm"" runat=""server"">" & vbCrLf strForm += "<asp:button name=""myName"" .... runat=""server"" />" & vbCrLf
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 created using javascript are available at the server? if not how can i do the above thing so that there values can be accessed. I dont want to postback page everytime i need to create a new element.
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 cannot be set at run time on elements dynamically created with the createElement method. To create an element with a name attribute, include the attribute and value when using the createElement method." to work around this you have to code:
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 school, a text box for degree, and a text box for concentration. The form shows 3 of these groupings by default but would like the user to be able to "add more" 3 element groupings if need be and "remove" the additional elements if needed. The schools...
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 dynamic text boxes are created and if user selects 4 then 4 dynamic text boxes are created and so on. Here is the code I am using to dynamically create the text boxes: echo ("<form name='exam' action='exam_2.php' method='POST'>"); for...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.