Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 名称为';调整买方价格';不可聚焦_Javascript_Html_Jquery_Forms - Fatal编程技术网

Javascript 名称为';调整买方价格';不可聚焦

Javascript 名称为';调整买方价格';不可聚焦,javascript,html,jquery,forms,Javascript,Html,Jquery,Forms,下面是HTML和JavaScript,仅当选择了前面下拉列表中的一个选项时,才用于显示下拉列表。当我选择链接到以下下拉列表的控件时,它会工作,而当我选择未链接到以下下拉列表的第二个选项并单击提交时,它会抛出错误“name='AdjustmentBuyerPrice'的无效表单控件不可聚焦”。请指出我在代码中犯的错误 `{include file="header.tpl" page_name='Amazon Order Adjustment' extra_javascript=

下面是HTML和JavaScript,仅当选择了前面下拉列表中的一个选项时,才用于显示下拉列表。当我选择链接到以下下拉列表的控件时,它会工作,而当我选择未链接到以下下拉列表的第二个选项并单击提交时,它会抛出错误“name='AdjustmentBuyerPrice'的无效表单控件不可聚焦”。请指出我在代码中犯的错误

`{include file="header.tpl" page_name='Amazon Order Adjustment' extra_javascript='<script language="JavaScript" src="includes/update_shipping_info.js"></script>'}

{literal}
<style type="text/css">
#loading-icon {
    position: absolute; 
    top: 75px; 
    right: 250px; width: 
    32px; height: 32px;
    display: none; 
    background: url('/images/lightbox/loading.gif');
}
</style>
{/literal}

{if isset($tpl_error_msg) }
    <div id="message">{$tpl_error_msg}</div>
{/if}

{include file='view_order_snippet.tpl'}

<form name="amazon_order_adjustment" id="amazon_order_adjustment" method="post" action="amazon_order_adjustment.php?id={$id}&{$search_params}">
        <div class="row">
            <fieldset>
            <legend>Order Line Items</legend>
                <table id="table2" style="position: relative; float: left;">
                    <tr valign="top">
                        <th width="10%"></th>
                        <th width="10%">SKU</th>
                        <th width="30%">Item</th>
                        <th width="5%">Qty</th>
                        <th width="10%">Status</th>
                        <th width="15%">Ship Mode</th>
                        <th width="20%">Tracking#</th>
                    </tr>
                    {if !($update_shipping_info_flag)}
                        <tr>
                            <td colspan="7" align="center">No Items to display</td>
                        </tr>
                    {else}
                        {section name=lineitems loop=$tpl_order_list}
                            <tr id=row1 valign="top">
                                <td><input type="radio" name="check[]" value="{$tpl_order_list[lineitems].id}">
                                <input type="hidden" name="vendor_id_array[]" value="{$tpl_order_list[lineitems].vendor_fk}">
                                </td>
                                <td>{$tpl_order_list[lineitems].sku}
                                <td>{$tpl_order_list[lineitems].item_description}</td>
                                <td>{$tpl_order_list[lineitems].quantity}</td>
                                <td>{$tpl_order_list[lineitems].item_status}</td>
                                <td>{$tpl_order_list[lineitems].shipping_mode}</td>
                                {if $tpl_order_list[lineitems].shipping_tracking_no == ""}
                                <td>N/A</td>
                                {else}
                                <td>{$tpl_order_list[lineitems].shipping_tracking_no}</td>
                                {/if}
                            </tr>
                        {/section}
                    {/if}
                    <tr>
                        <td align="right" colspan="3">Action Type</td>
                        <td align="left" colspan="4">
                            <select id="action_type" name="action_type" required>   
                                <option value="">Select Action</option>
                                {html_options options=$tpl_action_type}
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" colspan="3">Enter Refund Amount</td>
                        <td align="left" colspan="4"><input type="number" step="1" min="" id="refund_amount" name="refund_amount" value="" required /></td>
                    </tr>
                    <tr>
                        <td align="right" colspan="3">Adjustment Reason</td>
                        <td align="left" colspan="4">
                            <select id="AdjustmentReason" name="AdjustmentReason" required> 
                                <option value="" selected="selected">Select Adjustment Reason</option>
                                {html_options options=$tpl_adjustment_reason}                           
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" colspan="3">Adjustment Type</td>
                        <td align="left" colspan="4">
                            <select id="adjustment_type" name="adjustment_type" required>   
                                <option value="" selected="selected">Select Adjustment Type</option>
                                {html_options options=$tpl_adjustment_type}                             
                            </select>
                        </td>
                    </tr>
                    <tr id="adjustment_buyer_price">
                        <td align="right" colspan="3">Adjustment Buyer Price Type</td>
                        <td align="left" colspan="4">
                            <select id="AdjustmentBuyerPrice" name="AdjustmentBuyerPrice" required> 
                                <option value="">Select Adjustment Buyer Price Type</option>
                                {html_options options=$tpl_adjustment_buyer_price}
                            </select>
                        </td>
                    </tr>
                </table>
            </fieldset>
        </div>
        <div class="row">
            <input type="hidden" id="tpl_grand_total_box" name="tpl_grand_total_box" value="{$tpl_grand_total}">
            <input type="hidden" id="tpl_tax_box" name="tpl_tax_box" value="{$tpl_tax}">
            <input type="submit" id="save_button" name="submit_action" value="refund" class="button">
            <input type="submit" id="cancel_button" name="cancel_action" value="Cancel" class="button">
        </div>
    </div>
</form>
{literal}
<script type="text/javascript">
    $(document).ready(function() {
        $('#adjustment_buyer_price').hide(); 
        $("#adjustment_type").change(function () {
            var cur_option_val = $(this).val(); 
            if (cur_option_val == "ItemPriceAdjustments") {
                $('#adjustment_buyer_price').show(); 
                $('#AdjustmentBuyerPrice').attr("required", "required") //add required
            } else {
                $('#adjustment_buyer_price').hide();
                $('#AdjustmentBuyerPrice').removeAttr("required") //remove required.
            }
        });
    }); 
</script>
{/literal}
{include file="footer.tpl"}
`{include file=“header.tpl”page\u name='Amazon订单调整'extra\u javascript='''}
{literal}
#加载图标{
位置:绝对位置;
顶部:75px;
右:250px;宽度:
32px;高度:32px;
显示:无;
背景:url('/images/lightbox/loading.gif');
}
{/literal}
{if-isset($tpl\u error\u msg)}
{$tpl_error_msg}
{/if}
{include file='view'\u order'\u snippet.tpl'}
订单行项目
SKU
项目
数量
地位
船型
追踪#
{if!($update\u shipping\u info\u flag)}
没有要显示的项目
{else}
{section name=lineitems循环=$tpl\u order\u list}
{$tpl_订单_列表[lineitems].sku}
{$tpl\订单\列表[lineitems]。项目\说明}
{$tpl\订单\列表[lineitems].quantity}
{$tpl\u订单\u列表[lineitems]。项目\u状态}
{$tpl\订单\列表[lineitems]。配送\模式}
{如果$tpl\u订单\u列表[lineitems]。配送\u跟踪\u编号=“”
不适用
{else}
{$tpl\ U订单\列表[lineitems]。发货\跟踪\编号}
{/if}
{/section}
{/if}
动作类型
选择动作
{html_options options=$tpl_action_type}
输入退款金额
调整原因
选择调整原因
{html_options options=$tpl_adjustment_reason}
调整类型
选择调整类型
{html_options options=$tpl_adjustment_type}
调整买方价格类型
选择调整买方价格类型
{html_options options=$tpl_adjustment_buyer_price}
{literal}
$(文档).ready(函数(){
$('调整\买方\价格').hide();
$(“#调整类型”)。更改(功能(){
var cur_option_val=$(this.val();
如果(当前选项值=“项目价格调整”){
美元(调整买方价格)。显示();
$('AdjustmentBuyerPrice').attr(“必需的”,“必需的”)//添加必需的
}否则{
$('调整\买方\价格').hide();
$('AdjustmentBuyerPrice')。removeAttr(“必需”)//remove required。
}
});
}); 
{/literal}
{include file=“footer.tpl”}

发生这种情况是因为您将
调整买方价格
作为
必需的
所以当您没有选择值
项目价格调整
时,它是隐藏的,当您单击提交按钮时,错误显示。相反,当选择框隐藏时,您可以删除
必需的
属性,否则需要添加属性

演示代码

$(文档).ready(函数(){
$('调整\买方\价格').hide();
$(“#调整类型”)。更改(函数(){
var cur_option_val=$(this.val();
如果(当前选项值=“项目价格调整”){
美元(调整买方价格)。显示();
$('AdjustmentBuyerPrice').attr(“必需的”,“必需的”)//添加必需的
}否则{
$('调整\买方\价格').hide();
$('AdjustmentBuyerPrice')。removeAttr(“必需”)//删除
}
});
});

订单行项目
SKU
项目
数量
地位
船型
追踪#
没有要显示的项目
A.
B
5.
好啊
热媒
不适用
动作类型
选择动作
A.
输入退款金额