title: Javascript document.form.submit not working
body: <p>I have created a form using JavaScript and tried to submit it but it show error message <code>document.payment</code> is null. Please help me</p>
  <pre><code> var output_data = '&lt;form   id =&quot;payment&quot; name=&quot;payment&quot; method=&quot;POST&quot; action=&quot;https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/922635804601464&quot; accept-charset=&quot;utf-8&quot;&gt;'
                                  output_data += '&lt;input type=&quot;hidden&quot; name=&quot;item_name_1&quot; value=&quot;Peanut Butter&quot;&gt;';
                                  output_data +='&lt;input type=&quot;hidden&quot; name=&quot;item_description_1&quot; value=&quot;Chunky peanut butter.&quot;&gt;';
                                  output_data += '&lt;input type=&quot;hidden&quot; name=&quot;item_quantity_1&quot; value=&quot;1&quot;&gt;';
                                  output_data += '&lt;input type=&quot;hidden&quot; name=&quot;item_price_1&quot; value=&quot;3.99&quot;&gt;';
                                  output_data += '&lt;input type=&quot;hidden&quot; name=&quot;item_currency_1&quot; value=&quot;USD&quot;&gt;';
                                  output_data += '&lt;input type=&quot;hidden&quot; name=&quot;ship_method_name_1&quot; value=&quot;UPS Ground&quot;&gt;';
                                  output_data += '&lt;input type=&quot;hidden&quot; name=&quot;ship_method_price_1&quot; value=&quot;10.99&quot;&gt;';
                                  output_data += '&lt;input type=&quot;hidden&quot; name=&quot;ship_method_currency_1&quot; value=&quot;USD&quot;&gt;';
                                  output_data += '&lt;input type=&quot;hidden&quot; name=&quot;tax_rate&quot; value=&quot;0.0875&quot;&gt;';
                                  output_data += '&lt;input type=&quot;hidden&quot; name=&quot;tax_us_state&quot; value=&quot;NY&quot;&gt;';
                                  output_data += '&lt;input type=&quot;hidden&quot; name=&quot;_charset_&quot;&gt;';
                                  output_data += '&lt;/form&gt;';
                                  //alert(output_data);
                                  //return false;
                                  output_data += &quot;&lt;script&gt;&quot;;
                                  output_data += &quot;document.getElementById('payment').submit();&quot;;
                                  output_data += &quot;&lt;/script&gt;&quot;;                
                                  document.write(output_data);    
  </code></pre>