0

我在一页中有 2 个 Pay Pal 表格,第一个可以正常工作,但第二个返回错误:

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 @"tamararie@gmail.com" ?>">
                                        <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 @"tamararie@gmail.com" ?>">
                                                <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; ?>

这是该页面的链接: 网站页面

链接是每本书下的 2 个购买链接。

4

1 回答 1

0

id第二种形式的 设置为secondPriceForm。您目前仅设置name.

于 2013-03-20T14:22:00.080 回答