2013-03-20 69 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

相关问题