我有一个带有两个下拉类型前置字段的表单。第一个工作,但第二个必须根据第一个值的输入使用不同的视图(实际上是第一个输入后存储的viewScope变量)。无论输入第一个下拉列表,第二个下拉列表都是空的。我将为下面第二个字段的selectItems包含我的代码。我还将包含可见代码,仅在某些情况下显示第二个字段。你能看看我有什么吗?谢谢你的帮助。 (代码中的视图都是数据源)
switch(viewScope.vsTieIn) {
case "0046":
return viewAceLkup.getColumnValues(0) + viewAceLkup.getColumnValues(1) + viewAceLkup.getColumnValues(2) + "|" + viewAceLkup.getColumnValues(0);
break;
case "0009":
return viewDIBLkup.getColumnValues(0) + viewDIBLkup.getColumnValues(1) + viewDIBLkup.getColumnValues(2) + "|" + viewDIBLkup.getColumnValues(0);
break;
case "0166":
return viewOrgillLkup.getColumnValues(0) + viewOrgillLkup.getColumnValues(1) + viewOrgillLkup.getColumnValues(2) + "|" + viewOrgillLkup.getColumnValues(0);
break;
case "0016":
return viewPPGLkup.getColumnValues(0) + viewPPGLkup.getColumnValues(1) + viewPPGLkup.getColumnValues(2) + "|" + viewPPGLkup.getColumnValues(0);
break;
case "0005":
return viewTrueValueLkup.getColumnValues(0) + viewTrueValueLkup.getColumnValues(1) + viewTrueValueLkup.getColumnValues(2) + "|" + viewTrueValueLkup.getColumnValues(0);
break;
case "0026":
return viewAllProLkup.getColumnValues(0) + viewAllProLkup.getColumnValues(1) + viewAllProLkup.getColumnValues(2) + "|" + viewAllProLkup.getColumnValues(0);
break;
}
可见代码:
getComponent("DropShip").getValue() ||
viewScope.vsTieIn == "0046" ||
viewScope.vsTieIn == "0009" ||
viewScope.vsTieIn == "0166" ||
viewScope.vsTieIn == "0016" ||
viewScope.vsTieIn == "0005" ||
viewScope.vsTieIn == "0026";
这是xsp代码:
<xe:djFilteringSelect
id="djFilteringSelect1"
value="#{document1.CustInput}"
ignoreCase="true"
promptMessage="Enter a Customer ID, Phone or Name"
invalidMessage="Invalid Entry - check spelling"
style="width:150px"
autoComplete="true">
<xe:this.rendered><![CDATA[#{javascript:getComponent("DropShip").getValue() ||
viewScope.vsTieIn == "0046" ||
viewScope.vsTieIn == "0009" ||
viewScope.vsTieIn == "0166" ||
viewScope.vsTieIn == "0016" ||
viewScope.vsTieIn == "0005" ||
viewScope.vsTieIn == "0026";}]]></xe:this.rendered>
<xp:selectItem
itemLabel=""
id="selectItem2">
</xp:selectItem>
<xp:selectItems id="selectItems1">
<xp:this.value><![CDATA[#{javascript:switch(viewScope.vsTieIn) {
case "0046":
return viewAceLkup.getColumnValues(0) + viewAceLkup.getColumnValues(1) + viewAceLkup.getColumnValues(2) + "|" + viewAceLkup.getColumnValues(0);
break;
case "0009":
return viewDIBLkup.getColumnValues(0) + viewDIBLkup.getColumnValues(1) + viewDIBLkup.getColumnValues(2) + "|" + viewDIBLkup.getColumnValues(0);
break;
case "0166":
return viewOrgillLkup.getColumnValues(0) + viewOrgillLkup.getColumnValues(1) + viewOrgillLkup.getColumnValues(2) + "|" + viewOrgillLkup.getColumnValues(0);
break;
case "0016":
return viewPPGLkup.getColumnValues(0) + viewPPGLkup.getColumnValues(1) + viewPPGLkup.getColumnValues(2) + "|" + viewPPGLkup.getColumnValues(0);
break;
case "0005":
return viewTrueValueLkup.getColumnValues(0) + viewTrueValueLkup.getColumnValues(1) + viewTrueValueLkup.getColumnValues(2) + "|" + viewTrueValueLkup.getColumnValues(0);
break;
case "0026":
return viewAllProLkup.getColumnValues(0) + viewAllProLkup.getColumnValues(1) + viewAllProLkup.getColumnValues(2) + "|" + viewAllProLkup.getColumnValues(0);
break;
}
}]]></xp:this.value>
</xp:selectItems>
<xp:eventHandler
event="onChange"
submit="true"
refreshMode="partial"
id="eventHandler10" refreshId="custTable">
<xe:this.action><![CDATA[#{javascript:var compID = getComponent("djFilteringSelect1").getValue();
var custDoc:NotesDocument = viewCustByID.getDocumentByKey(compID);
//Set Billing Info
document1.setValue("BillCompID", custDoc.getItemValue("CustID"));
viewScope.vsBillCompID = custDoc.getItemValue("CustID");
viewScope.vsBillFax = custDoc.getItemValue("CustFax");
//Set Shipping Info
document1.setValue("ShipCompName", custDoc.getItemValue("CustShipName"));
document1.setValue("ShipAddr1", custDoc.getItemValue("CustShipAddr1"));
document1.setValue("ShipAddr2", custDoc.getItemValue("CustShipAddr2"));
document1.setValue("ShipAddr3", custDoc.getItemValue("CustShipAddr3"));
document1.setValue("ShipCity", custDoc.getItemValue("CustShipCity"));
document1.setValue("ShipState", custDoc.getItemValue("CustShipState"));
document1.setValue("ShipZip", custDoc.getItemValue("CustShipZip"));
document1.setValue("ShipProv", custDoc.getItemValue("CustShipProv"));
document1.setValue("ShipCountry", custDoc.getItemValue("CustShipCntry"));
var a = custDoc.getItemValue("CustBillName");
var b = custDoc.getItemValue("CustBillAddr1");
var c = custDoc.getItemValue("CustBillAddr2");
var d = custDoc.getItemValue("CustBillAddr3");
var e = custDoc.getItemValue("CustBillCity");
var f = custDoc.getItemValue("CustBillState");
var g = custDoc.getItemValue("CustBillZip");
var h = custDoc.getItemValue("CustBillProv");
var i = custDoc.getItemValue("CustBillCntry");
var j = custDoc.getItemValue("CustPhone");
viewScope.a = custDoc.getItemValueString("CustBillName");
viewScope.b = custDoc.getItemValueString("CustBillAddr1");
viewScope.c = custDoc.getItemValueString("CustBillAddr2");
viewScope.d = custDoc.getItemValueString("CustBillAddr3");
viewScope.e = custDoc.getItemValueString("CustBillCity");
viewScope.f = custDoc.getItemValueString("CustBillState");
viewScope.g = custDoc.getItemValueString("CustBillZip");
viewScope.h = custDoc.getItemValueString("CustBillProv");
viewScope.i = custDoc.getItemValueString("CustBillCntry");
viewScope.j = custDoc.getItemValueString("CustPhone");
document1.setValue("BillCompInfo", a + "<br />" + b + (c ? "<br />" + c : "") + (d ? "<br />" + d : "") + "<br />" + e + ", " + f + g + (h ? "<br />" + h + " " : "") + (i ? ", " + i : "") + (j ? "<br />" + j : ""));
document1.setValue("OrderStatus", "Draft");
viewScope.vsTerms = custDoc.getItemValue("CustTerms");
viewScope.vsDiscCode = custDoc.getItemValue("CustDiscCode");
viewScope.vsTradeDisc = custDoc.getItemValue("CustTradeDisc");
viewScope.vsTieIn = custDoc.getItemValue("CustTieIn");
viewScope.vsPromoCode = custDoc.getItemValue("CustPromoGroup");
viewScope.vsPromoBypass = custDoc.getItemValue("CustPromoBypass");
document1.setValue("djFilteringSelect1", "");
getComponent("djFilteringSelect1").setValue("");
if(document1.isNewNote()) {
var vUNID = session.evaluate("@Unique").elementAt(0);
document1.setValue("OrderUNID", vUNID);
viewScope.vsOrderUNID = vUNID;
}
}]]></xe:this.action>
</xp:eventHandler>
</xe:djFilteringSelect>