2013-03-20 65 views
0

我有一個第2種薪酬PAL形式,第一個工作正常,但第二個返回一個錯誤:2形式的行動在一個頁面中導致錯誤

TypeError: 'undefined' is not an object (evaluating 'document.secondPriceForm.submit') 

這是我的代碼:

     <div id="deatails"> 
         <?php while(has_sub_field("meta_data")): ?> 

          <table> 
          <!-- table row for price START--> 
          <tr> 
          <?php if(get_row_layout() == "pay_pal_data"): // layout: Content 
            if(get_sub_field("sold_out")): 
            echo 'Sold out'; 
            else:?> 

           <form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="regularPriceForm" name="regularPriceForm"> 
           <td class="price price-label"> 
             <input type="hidden" name="cmd" value="_xclick"> 
             <input type="hidden" name="business" value="<?php echo @"[email protected]" ?>"> 
             <input type="hidden" name="item_name" value="<?php the_title(get_field('cover_image')) ?> "> 
             <div class="meta-text item-field_price"><?php the_sub_field("regular_price_description"); echo (' : '); the_sub_field("regular_price"); echo '$' ?></div> 
             <input type="hidden" name="amount" value="<?php the_sub_field("regular_price"); ?>"> 
             <input type="hidden" name="no_shipping" value="2"> 
             <input type="hidden" name="no_note" value="0"> 
             <input type="hidden" name="currency_code" value="<?php echo 'USD' ?>"> 
             <input type="hidden" name="country" value="<?php echo 'US' ?>"> 
           </td> 
           <td class='quantity price-label'>  
            qty. <input type="number" name="quantity" value="1" maxlength="9" min="1" max='9'> 
           </td> 
           <td class="submitButtonTd price-label"> 
             <input type="hidden" name="bn" value="PP-BuyNowBF"> 
             <a class='meta-text' href='javaScript:document.regularPriceForm.submit();'>Purchase</a> 
           </td> 
           </form> 
          </tr> 
          <!-- END OF table row for price --> 


          <!-- table row for additional price START--> 
          <?php if(get_sub_field('additional_price')):?> 
           <tr> 
            <form> 


            <td class="form-description-td"> 
             <form action="https://www.paypal.com/cgi-bin/webscr" method="post" name="secondPriceForm"> 
               <input type="hidden" name="cmd" value="_xclick"> 
               <input type="hidden" name="business" value="<?php echo @"[email protected]" ?>"> 
               <input type="hidden" name="item_name" value="<?php the_title(get_field('cover_image')) ?> "> 
               <div class="meta-text item-field_price"><?php the_sub_field("additional_price_description"); echo (' : '); the_sub_field("additional_price"); echo '$' ?></div> 
               <input type="hidden" name="amount" value="<?php the_sub_field("additional_price"); ?>"> 
               <input type="hidden" name="no_shipping" value="2"> 
               <input type="hidden" name="no_note" value="0"> 
               <input type="hidden" name="currency_code" value="<?php echo 'USD' ?>"> 
               <input type="hidden" name="country" value="<?php echo 'US' ?>"> 

            </td> 
            <td class='quantity price-label'>  
            qty. <input type="number" name="quantity" value="1" maxlength="9" min="1" max='9'> 
            </td> 
            <td class="submitButtonTd"> 
               <input type="hidden" name="bn" value="PP-BuyNowBF"> 
               <a class='meta-text' href='javaScript:document.secondPriceForm.submit();'>Purchase</a> 
            </td> 
            </form> 
           </tr> 
           <!-- END OF table row for additional price --> 
           <?php endif; ?> 

          <?php endif; ?> 
          <!-- END OF table row for pay_pal_data--> 




          <!-- table row for print_meta START--> 
          <?php elseif(get_row_layout() == "print_meta"): // layout: File ?> 


          <tr> 

           <td class='meta-text'> Size: <?php if(get_sub_field("size")){ the_sub_field("size");} ?></td> 
           <td class='meta-text right-meta-text'><?php if(get_sub_field("series_size")){ echo 'Limited edition of '; the_sub_field("series_size");} ?> </td> 
          </tr> 

          <!-- END OF table row for print_meta--> 


          <?php endif; ?> 

          </table> 

          <?php endwhile; ?> 

這是鏈接到頁面: Website Page

鏈接是每本書下的兩個購買鏈接。

+2

你的HTML是無效的!修復這個!表單不是表格的子元素。使用[W3C校驗(http://validator.w3.org/) – epascarello 2013-03-20 14:20:34

+0

@epascarello謝謝,你能指出我的問題? – shannoga 2013-03-20 14:21:35

+0

我明白了,我不知道這是不允許把一個形式的表。我會解決這個問題。謝謝。爲什麼不允許BTW? – shannoga 2013-03-20 14:29:34

回答

0

設置的第二種形式的idsecondPriceForm。您目前只設置了name

相關問題