<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Dynamically add form fields using javascript and DOM with dynamic post method</title>
	<atom:link href="http://blog.tangorangers.com/2009/05/dynamically-add-form-fields-using-javascript-and-dom-with-dynamic-post-method/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.tangorangers.com/2009/05/dynamically-add-form-fields-using-javascript-and-dom-with-dynamic-post-method/</link>
	<description>Misc crap and such</description>
	<lastBuildDate>Wed, 14 Dec 2011 02:21:27 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: jcode</title>
		<link>http://blog.tangorangers.com/2009/05/dynamically-add-form-fields-using-javascript-and-dom-with-dynamic-post-method/comment-page-1/#comment-4916</link>
		<dc:creator>jcode</dc:creator>
		<pubDate>Wed, 02 Mar 2011 19:13:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tangorangers.com/?p=120#comment-4916</guid>
		<description>Hey I was wondering if you could help me out. I am creating a form where people can add more crates to their order by clicking the &quot;add&quot; button. When they click it, I would like it to return my unique_input field. Any thoughts?

&lt;code&gt;

    Crate
    
 


&lt;strong&gt;Next Crate (Width x Height x Depth):&lt;/strong&gt;

function add(type) {
 
    //Create an input type dynamically.
    var element = document.createElement(&quot;input&quot;);
 
    //Assign different attributes to the element.
    element.setAttribute(&quot;type&quot;, type);
    element.setAttribute(&quot;value&quot;, type);
    element.setAttribute(&quot;name&quot;, type);
	 
    var foo = document.getElementById(&quot;unique_input&quot;);
 
    //Append the element in page (in span).
    foo.appendChild(element);
 
}

&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Hey I was wondering if you could help me out. I am creating a form where people can add more crates to their order by clicking the &#8220;add&#8221; button. When they click it, I would like it to return my unique_input field. Any thoughts?</p>
<p><code></p>
<p>    Crate</p>
<p><strong>Next Crate (Width x Height x Depth):</strong></p>
<p>function add(type) {</p>
<p>    //Create an input type dynamically.<br />
    var element = document.createElement("input");</p>
<p>    //Assign different attributes to the element.<br />
    element.setAttribute("type", type);<br />
    element.setAttribute("value", type);<br />
    element.setAttribute("name", type);</p>
<p>    var foo = document.getElementById("unique_input");</p>
<p>    //Append the element in page (in span).<br />
    foo.appendChild(element);</p>
<p>}</p>
<p></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexis</title>
		<link>http://blog.tangorangers.com/2009/05/dynamically-add-form-fields-using-javascript-and-dom-with-dynamic-post-method/comment-page-1/#comment-2844</link>
		<dc:creator>Alexis</dc:creator>
		<pubDate>Mon, 22 Nov 2010 21:43:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tangorangers.com/?p=120#comment-2844</guid>
		<description>Fixed it!  I had the add_barcode() function called by an onChange event in the text fields.  Setting it to onFocus fixed it.  Thanks for the code and your help!</description>
		<content:encoded><![CDATA[<p>Fixed it!  I had the add_barcode() function called by an onChange event in the text fields.  Setting it to onFocus fixed it.  Thanks for the code and your help!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexis</title>
		<link>http://blog.tangorangers.com/2009/05/dynamically-add-form-fields-using-javascript-and-dom-with-dynamic-post-method/comment-page-1/#comment-2842</link>
		<dc:creator>Alexis</dc:creator>
		<pubDate>Mon, 22 Nov 2010 20:25:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tangorangers.com/?p=120#comment-2842</guid>
		<description>maybe if I escape the double and single quotes...
&lt;form action=\&quot;\&quot; method=\&quot;post\&quot; enctype=\&quot;multipart/form-data\&quot; name=\&quot;form_addMediaLogEntry\&quot; id=\&quot;form_addMediaLogEntry\&quot;&gt;
  
  
  Barcodes: 
  
    
  
  
    
  

 
  
  
</description>
		<content:encoded><![CDATA[<p>maybe if I escape the double and single quotes&#8230;<br />
&lt;form action=\&quot;\&#8221; method=\&#8221;post\&#8221; enctype=\&#8221;multipart/form-data\&#8221; name=\&#8221;form_addMediaLogEntry\&#8221; id=\&#8221;form_addMediaLogEntry\&#8221;&gt;</p>
<p>  Barcodes:</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexis</title>
		<link>http://blog.tangorangers.com/2009/05/dynamically-add-form-fields-using-javascript-and-dom-with-dynamic-post-method/comment-page-1/#comment-2841</link>
		<dc:creator>Alexis</dc:creator>
		<pubDate>Mon, 22 Nov 2010 20:23:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tangorangers.com/?p=120#comment-2841</guid>
		<description>Yes, I tried manually keying in numbers and hitting tab and it does the same thing in Firefox and IE - skips the new field and goes to the button.  Just realized that the code for the form got left out of my post above.  Again, I really appreciate your help with this!

&lt;form action=&quot;&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot; name=&quot;form_addMediaLogEntry&quot; id=&quot;form_addMediaLogEntry&quot;&gt;
  
  
  Barcodes: 
  
    
  
  
    
  

 
  
  
</description>
		<content:encoded><![CDATA[<p>Yes, I tried manually keying in numbers and hitting tab and it does the same thing in Firefox and IE &#8211; skips the new field and goes to the button.  Just realized that the code for the form got left out of my post above.  Again, I really appreciate your help with this!</p>
<p>&lt;form action=&quot;&#8221; method=&#8221;post&#8221; enctype=&#8221;multipart/form-data&#8221; name=&#8221;form_addMediaLogEntry&#8221; id=&#8221;form_addMediaLogEntry&#8221;&gt;</p>
<p>  Barcodes:</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DaijoubuKun</title>
		<link>http://blog.tangorangers.com/2009/05/dynamically-add-form-fields-using-javascript-and-dom-with-dynamic-post-method/comment-page-1/#comment-2824</link>
		<dc:creator>DaijoubuKun</dc:creator>
		<pubDate>Sun, 21 Nov 2010 16:58:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tangorangers.com/?p=120#comment-2824</guid>
		<description>I have tested the code over and over again. I can not see why when your scanner would send the Tab that it wouldn&#039;t goto the next field. I tested this under IE8 and FireFox in XP and FireFox on Linux. Every time I manually hit the Tab button it moves to the next field. Did you have this problem before adding the javascript? Have you tried just typing in some numbers and hitting Tab to see how it reacts? Perhaps the scanner isn&#039;t sending the correct key.</description>
		<content:encoded><![CDATA[<p>I have tested the code over and over again. I can not see why when your scanner would send the Tab that it wouldn&#8217;t goto the next field. I tested this under IE8 and FireFox in XP and FireFox on Linux. Every time I manually hit the Tab button it moves to the next field. Did you have this problem before adding the javascript? Have you tried just typing in some numbers and hitting Tab to see how it reacts? Perhaps the scanner isn&#8217;t sending the correct key.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexis</title>
		<link>http://blog.tangorangers.com/2009/05/dynamically-add-form-fields-using-javascript-and-dom-with-dynamic-post-method/comment-page-1/#comment-2790</link>
		<dc:creator>Alexis</dc:creator>
		<pubDate>Fri, 19 Nov 2010 22:24:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tangorangers.com/?p=120#comment-2790</guid>
		<description>Thanks for the quick reply!  I&#039;m having trouble getting it to work.  I made a form to use with a barcode scanner to scan in multiple barcodes to post to my database.  The scanner adds a tab after the barcode, but instead of the focus jumping to the newly added field it jumps to the Add Row button.  Any help is much appreciated!


// JavaScript Document
//http://www.tangorangers.com/examples/dynadddynpost/index.php
var counter = 0;
//Start a counter. Yes, at 0
function add_barcode() {
    counter++;
// I find it easier to start the incrementing of the counter here.
    var newFields = document.getElementById(&#039;add_barcode&#039;).cloneNode(true);
    newFields.id = &#039;&#039;;
    newFields.style.display = &#039;block&#039;;
    var newField = newFields.childNodes;
    for (var i=0;i&lt;newField.length;i++) {
        var theName = newField[i].name
        if (theName)
                newField[i].name = theName + counter
// This will change the &#039;name&#039; field by adding an auto incrementing number at the end. This is important.
        }
        var insertHere = document.getElementById(&#039;add_barcode&#039;);
// Inside the getElementById brackets is the name of the div class you will use.
        insertHere.parentNode.insertBefore(newFields,insertHere);
		document.form_addMediaLogEntry.name[theName].focus();
}



&lt;form action=&quot;&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot; name=&quot;form_addMediaLogEntry&quot; id=&quot;form_addMediaLogEntry&quot;&gt;
  
  
  Barcodes: 
  
    
  
  
    
  

 
  
  
</description>
		<content:encoded><![CDATA[<p>Thanks for the quick reply!  I&#8217;m having trouble getting it to work.  I made a form to use with a barcode scanner to scan in multiple barcodes to post to my database.  The scanner adds a tab after the barcode, but instead of the focus jumping to the newly added field it jumps to the Add Row button.  Any help is much appreciated!</p>
<p>// JavaScript Document<br />
//http://www.tangorangers.com/examples/dynadddynpost/index.php<br />
var counter = 0;<br />
//Start a counter. Yes, at 0<br />
function add_barcode() {<br />
    counter++;<br />
// I find it easier to start the incrementing of the counter here.<br />
    var newFields = document.getElementById(&#8216;add_barcode&#8217;).cloneNode(true);<br />
    newFields.id = &#8221;;<br />
    newFields.style.display = &#8216;block&#8217;;<br />
    var newField = newFields.childNodes;<br />
    for (var i=0;i&lt;newField.length;i++) {<br />
        var theName = newField[i].name<br />
        if (theName)<br />
                newField[i].name = theName + counter<br />
// This will change the &#039;name&#039; field by adding an auto incrementing number at the end. This is important.<br />
        }<br />
        var insertHere = document.getElementById(&#039;add_barcode&#039;);<br />
// Inside the getElementById brackets is the name of the div class you will use.<br />
        insertHere.parentNode.insertBefore(newFields,insertHere);<br />
		document.form_addMediaLogEntry.name[theName].focus();<br />
}</p>
<p>&lt;form action=&quot;&#8221; method=&#8221;post&#8221; enctype=&#8221;multipart/form-data&#8221; name=&#8221;form_addMediaLogEntry&#8221; id=&#8221;form_addMediaLogEntry&#8221;&gt;</p>
<p>  Barcodes:</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DaijoubuKun</title>
		<link>http://blog.tangorangers.com/2009/05/dynamically-add-form-fields-using-javascript-and-dom-with-dynamic-post-method/comment-page-1/#comment-2713</link>
		<dc:creator>DaijoubuKun</dc:creator>
		<pubDate>Tue, 16 Nov 2010 00:27:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tangorangers.com/?p=120#comment-2713</guid>
		<description>That is a great question. The answer is... I don&#039;t know. I will have to look into that. Please check back and hopefully I will have found an answer for you.

EDIT: I love google. Try this out: http://www.codeave.com/javascript/code.asp?u_log=7017</description>
		<content:encoded><![CDATA[<p>That is a great question. The answer is&#8230; I don&#8217;t know. I will have to look into that. Please check back and hopefully I will have found an answer for you.</p>
<p>EDIT: I love google. Try this out: <a href="http://www.codeave.com/javascript/code.asp?u_log=7017" rel="nofollow">http://www.codeave.com/javascript/code.asp?u_log=7017</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexis</title>
		<link>http://blog.tangorangers.com/2009/05/dynamically-add-form-fields-using-javascript-and-dom-with-dynamic-post-method/comment-page-1/#comment-2709</link>
		<dc:creator>Alexis</dc:creator>
		<pubDate>Mon, 15 Nov 2010 22:34:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tangorangers.com/?p=120#comment-2709</guid>
		<description>Hi,

This is really useful, thanks!

One question, how would I go about automatically setting the focus to the most recently added field?</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>This is really useful, thanks!</p>
<p>One question, how would I go about automatically setting the focus to the most recently added field?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DaijoubuKun</title>
		<link>http://blog.tangorangers.com/2009/05/dynamically-add-form-fields-using-javascript-and-dom-with-dynamic-post-method/comment-page-1/#comment-467</link>
		<dc:creator>DaijoubuKun</dc:creator>
		<pubDate>Tue, 06 Apr 2010 22:44:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tangorangers.com/?p=120#comment-467</guid>
		<description>As previously noted I DO NOT have a remove field script. A friend tells me he has one, he has yet to provide me the code as there are some issues he would like to resolve. As soon as I have it I will post it.</description>
		<content:encoded><![CDATA[<p>As previously noted I DO NOT have a remove field script. A friend tells me he has one, he has yet to provide me the code as there are some issues he would like to resolve. As soon as I have it I will post it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: afwan auliyar</title>
		<link>http://blog.tangorangers.com/2009/05/dynamically-add-form-fields-using-javascript-and-dom-with-dynamic-post-method/comment-page-1/#comment-466</link>
		<dc:creator>afwan auliyar</dc:creator>
		<pubDate>Tue, 06 Apr 2010 12:08:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tangorangers.com/?p=120#comment-466</guid>
		<description>thanks for this tutorial ...
Is there a script for &quot;remove&quot; this field which &quot;add&quot; before ?!?</description>
		<content:encoded><![CDATA[<p>thanks for this tutorial &#8230;<br />
Is there a script for &#8220;remove&#8221; this field which &#8220;add&#8221; before ?!?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

