您好,我有两个下拉菜单(但是您需要在显示建议的单词之前开始输入内容),第一个下拉菜单称为“产品”,第二个下拉菜单称为“商品”,我希望如果用户选择“产品下拉菜单” ,则商品下拉列表将被隐藏,并且字段要求也将为假。反之,如果用户选择“商品”下拉菜单,则“商品”下拉列表将被隐藏,并且“字段需求”将为false。请帮我解决这个问题。我见过我的同样问题,但没有一个对我有用
这是产品下拉代码:
<?php if( (!isset($_POST["quickAddOnly"])) || "NO" == "NO" ){ ?>
<tr style="">
<td valign=top class="tb" scope="row"> <label for="Product">Product</label> <span class="required" style="color:red" >*</span> </td>
<td valign=top>:</td>
<td scope="row">
<?php
$keyrow = getProductsFilters(array_qval( $data, "product_id" , "" ),"name");
$forid = "";
$forid .= $keyrow["raw_name"];
?>
<input fieldError="Place a valid Product" fieldRequire="yes" type="hidden" name="product_id" id="Product" value="<?php echo trim(array_qval( $data, "product_id" , "" ));?>"/>
<input value="<?php echo $forid;?>" type="text" name="dropdown_product_id" autocomplete="off" style="width:297px; background-color: #f5f5f5" /><br /><small>start typing for suggestive dropdown menu of Products Name</small>
<script language="javascript">
$(document).ready(function(){
$("<?php echo $useform;?>input[name=dropdown_product_id]").each(function(){
$(this).dblclick( function(){
$(this).autocomplete( "search");
});
$(this).autocomplete({
source: function( request, response ) {
var lddText = "";
$.ajax({
type: "POST",
url: "products/xml/autocompleteProducts.php",
dataType: "json",
data: {
val : request.term,
field : "name|sku",
lookup : "id",
ldd : lddText
},
success: function( data ) {
response( data );
}
});
},
minLength: 0,
select: function( event, ui ) {
$(this).siblings("input[name=product_id]:first").val(ui.item.id).trigger("change");
$(this).addClass("input-ok").removeClass("input-ajax");
},
close: function(event, ui) {
if( $(this).siblings("input[name=product_id]:first").val() == "" || $(this).siblings("input[name=product_id]:first").val() == 0)
{
$(this).removeClass("input-ok");
}
$(this).removeClass("input-ajax");
},
search: function(event, ui) {
$(this).addClass("input-ajax");
$(this).siblings("input[name=product_id]:first").val("");
}
});
})
});
</script>
</td>
</tr>
<?php } ?>
这是商品下拉代码:
<!-- start of goods_info -->
<?php if( (!isset($_POST["quickAddOnly"])) || "NO" == "NO" ){ ?>
<tr style="">
<td valign=top class="tb" scope="row"> <label for="Goods">Goods</label> <span class="required" style="color:red" >*</span> </td>
<td valign=top>:</td>
<td scope="row">
<?php
$keyrow = getGoods_InfoFilters(array_qval( $data, "goods_id" , "" ),"name");
$forid = "";
$forid .= $keyrow["raw_goods_info_name"];
?>
<input fieldError="Place valid Goods" fieldRequire="yes" type="hidden" name="goods_id" id="Goods" value="<?php echo trim(array_qval( $data, "goods_id" , "" ));?>"/>
<input value="<?php echo $forid;?>" type="text" name="dropdown_goods_id" autocomplete="off" style="width:297px; background-color: #f5f5f5" /><br /><small>start typing for suggestive dropdown menu of Products Name</small>
<script language="javascript">
$(document).ready(function(){
$("<?php echo $useform;?>input[name=dropdown_goods_id]").each(function(){
$(this).dblclick( function(){
$(this).autocomplete( "search");
});
$(this).autocomplete({
source: function( request, response ) {
var lddText = "";
$.ajax({
type: "POST",
url: "goods_info/xml/autocompleteGoods_Info.php",
dataType: "json",
data: {
val : request.term,
field : "name|upteam_sku",
lookup : "id",
ldd : lddText
},
success: function( data ) {
response( data );
}
});
},
minLength: 0,
select: function( event, ui ) {
$(this).siblings("input[name=goods_id]:first").val(ui.item.id).trigger("change");
$(this).addClass("input-ok").removeClass("input-ajax");
},
close: function(event, ui) {
if( $(this).siblings("input[name=goods_id]:first").val() == "" || $(this).siblings("input[name=goods_id]:first").val() == 0)
{
$(this).removeClass("input-ok");
}
$(this).removeClass("input-ajax");
},
search: function(event, ui) {
$(this).addClass("input-ajax");
$(this).siblings("input[name=goods_id]:first").val("");
}
});
})
});
</script>
</td>
</tr>
<?php } ?>
<!-- end of goods info --->