我有一个自定义控件,可打开一个弹出窗口来填充一些工作项。
该项目是一个组合框,提供了其他3个字段(来源,查询者和原因)的值
组合框干预基于组合框的原因。
所有值均已正确填充,但由于所有字段均为必填项,因此也需要进行验证。
点击“提交”按钮时,验证已完成,但是将清空“干预”字段。
我找不到原因。任何帮助请
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xe="http://www.ibm.com/xsp/coreex">
<xe:dialog id="dlgNote">
<xe:this.title><![CDATA[#{javascript:
if (sessionScope.lang == "fr") {
"Note";
} else {
"Work Item";
}
}]]></xe:this.title>
<xp:panel>
<xp:this.data>
<xp:dominoDocument var="WorkItem" formName="WorkItem"
action="editDocument" documentId="#{javascript:viewScope.UNID}"
ignoreRequestParams="true" />
</xp:this.data>
<xp:inputText id="wi_ParentUNID1" value="#{WorkItem.wi_ParentUNID}"
defaultValue="#{javascript:client.getDocument().getUniversalID();}"
disabled="true" style="display:none" rendered="#{javascript:currentDocument.isEditable()}">
</xp:inputText>
<xp:inputText id="inputText2" value="#{WorkItem.wi_WeekNo}" disabled="true" style="display:none">
<xp:this.defaultValue><![CDATA[#{javascript:
now = new Date();
onejan = new Date(now.getFullYear(), 0, 1);
week = Math.ceil( (((now - onejan) / 86400000) + onejan.getDay() + 1) / 7 );
@Text(@Year(now)) + "-" + @Text(week);
}]]></xp:this.defaultValue>
</xp:inputText>
<xp:inputText id="inputText1"
value="#{WorkItem.wi_Province}" disabled="true" style="display:none"
rendered="#{javascript:currentDocument.isEditable()}">
<xp:this.defaultValue><![CDATA[#{javascript:getComponent("cli_Province").getValue()}]]></xp:this.defaultValue></xp:inputText>
<xp:inputText id="inputText3"
value="#{WorkItem.brokercode}" disabled="true" style="display:none"
rendered="#{javascript:currentDocument.isEditable()}">
<xp:this.defaultValue><![CDATA[#{javascript:getComponent("cli_BrokerID").getValue()}]]></xp:this.defaultValue></xp:inputText>
<xe:formTable id="formTable2" labelWidth="200px" labelPosition="above" disableErrorSummary="true" disableRowError="true">
<xp:this.facets>
<xe:formRow id="formRow15" xp:key="footer">
<xp:panel style="padding-top:8px;">
<xp:button value="Submit" id="button1">
<xp:this.rendered><![CDATA[#{javascript:
var dtcrt:java.util.Date = @Created();
var dtnow:java.util.Date = new Date();
var isSameDay:boolean = (dtnow.getFullYear()==dtcrt.getFullYear() && dtnow.getMonth()==dtcrt.getMonth() &&
dtnow.getDate()==dtcrt.getDate());
// Show button with new document
if (viewScope.UNID == "") {
return true;
// Show button for Administrator
} else if (database.queryAccessRoles(session.getEffectiveUserName()).contains('[Administration]')) {
return true;
// Show button to allows edition the same day until midnight.
} else if (isSameDay) {
return true;
// Otherwise hide button
} else {
return false;
}
}]]></xp:this.rendered>
<xp:eventHandler event="onclick"
submit="true" refreshMode="complete" save="true"
id="eventHandler3">
<xp:this.action><![CDATA[#{javascript:
WorkItem.save();
getComponent("dlgNote").hide();
}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:button value="Cancel" id="button2">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete" immediate="true" save="false" id="eventHandler4">
<xp:this.action><![CDATA[#{javascript:
requestScope.ButtonAction="";
getComponent("dlgNote").hide();
}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
</xp:panel>
</xe:formRow>
</xp:this.facets>
<xe:formColumn id="formColumn6">
<xe:formRow id="formRow1">
<xp:div><xp:message id="msg01" for="wi_Date"></xp:message></xp:div>
<xp:inputText id="wi_Date" value="#{WorkItem.wi_Date}" style="height:19px; width:194px;"
required="true" disableClientSideValidation="true">
<xp:this.converter>
<xp:convertDateTime
pattern="yyyy-MM-dd hh:mm:ss">
</xp:convertDateTime>
</xp:this.converter>
<xp:this.defaultValue><![CDATA[#{javascript:
@If(@IsNewDoc(), @Now(), getComponent("wi_Date").getValue());
}]]></xp:this.defaultValue>
<xp:this.validators>
<xp:validateRequired
message="You must enter a value.">
</xp:validateRequired>
</xp:this.validators>
</xp:inputText>
<xp:this.facets>
<xp:label id="label3" value="Date:" style="font-weight:bold; font-size:9pt;" xp:key="label"></xp:label>
</xp:this.facets>
</xe:formRow>
<xe:formRow id="formRow16">
<xp:div><xp:message id="msg02" for="wi_Project"></xp:message></xp:div>
<xp:comboBox id="wi_Project" style="font-size:9pt; height:19px; width:200px;"
value="#{WorkItem.wi_Project}" required="true" disableClientSideValidation="true">
<xp:this.validators>
<xp:validateRequired
message="You must select a value.">
</xp:validateRequired>
</xp:this.validators>
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:@Text("")}]]></xp:this.value>
</xp:selectItems>
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:
//var col = (sessionScope.lang == "fr" ? 3 : 4);
//@DbLookup(@DbName(),"VWL010","Project",col,"[FAILSILENT]");
/////////
var col = (sessionScope.lang == "fr" ? 3 : 4);
///////////////////////////////////////////
var doc:NotesDocument = currentDocument.getDocument();
if (doc.hasItem("wi_Date"))
{
var dt:NotesDateTime = doc.getItemValueDateTimeArray("wi_Date").elementAt(0);
// return @Day(dt.getDateOnly());
var y = @Text(@Year(dt.getDateOnly()));
var m = @Text(@Month(dt.getDateOnly()));
var d = @Text(@Day(dt.getDateOnly()));
var WorkItemdt = y + @Left(00+m,2) + @Left(00+d,2);
//return WorkItemdt;
//cutoff date pour voir les nouvelles listes déroulantes
if ((WorkItemdt) < "20190201")
{
//vieille
return @DbLookup(@DbName(),"VWL010A","Project",col,"[FAILSILENT]");
}
else{
//nouveau
return @DbLookup(@DbName(),"VWL010","Project",col,"[FAILSILENT]");
}
}
else{
//nouveau
return @DbLookup(@DbName(),"VWL010","Project",col,"[FAILSILENT]");
}
}]]></xp:this.value>
</xp:selectItems>
<xp:eventHandler event="onchange" submit="true" disableValidators="true"></xp:eventHandler>
</xp:comboBox>
<xp:this.facets>
<xp:label id="label2" value="Project:" style="font-weight:bold; font-size:9pt;" xp:key="label"></xp:label>
</xp:this.facets>
</xe:formRow>
<xe:formRow id="formRow12">
<xp:div><xp:message id="msg03" for="wi_Inquirer"></xp:message></xp:div>
<xp:comboBox id="wi_Inquirer" style="font-size:9pt; height:19px; width:200px;"
value="#{WorkItem.wi_Inquirer}" required="true" disableClientSideValidation="true">
<xp:this.validators>
<xp:validateRequired
message="You must select a value.">
</xp:validateRequired>
</xp:this.validators>
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:@Text("")}]]></xp:this.value>
</xp:selectItems>
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:
var col = (sessionScope.lang == "fr" ? 10 : 9);
//var strKey = getComponent("wi_Project").getSubmittedValue();
var strKey = getComponent("wi_Project").getValue();
if (strKey != null) {
strKey.trim();
}
var items = @DbLookup(@DbName(),"VWL010",strKey,col,"[FAILSILENT]");
if (items != null) {
return items;
}
}]]></xp:this.value>
</xp:selectItems>
</xp:comboBox>
<xp:this.facets>
<xp:label id="label7" value="Inquirer:" style="font-weight:bold; font-size:9pt;" xp:key="label"></xp:label>
</xp:this.facets>
</xe:formRow>
<xe:formRow id="formRow2">
<xp:checkBox text="Linked broker"
id="chkLinkedBroker" value="#{WorkItem.linkedbroker}" checkedValue="yes" uncheckedValue="no">
<xp:eventHandler event="onchange" submit="true" disableValidators="true"></xp:eventHandler>
</xp:checkBox>
</xe:formRow>
</xe:formColumn>
<xe:formColumn id="formColumn5">
<xe:formRow id="formRow13">
<xp:div><xp:message id="msg04" for="wi_AgentName"></xp:message></xp:div>
<xp:inputText id="wi_AgentName" value="#{WorkItem.wi_AgentName}"
style="font-size:9pt; height:19px; width:194px;" required="true" disableClientSideValidation="true">
<xp:this.defaultValue><![CDATA[#{javascript:
@If(@IsNewDoc(), @Name("[CN]", @UserName()), getComponent("wi_AgentName").getValue());
}]]></xp:this.defaultValue>
<xp:this.validators>
<xp:validateRequired
message="You must enter a value.">
</xp:validateRequired>
</xp:this.validators>
</xp:inputText>
<xp:this.facets>
<xp:label id="label4" style="font-weight:bold; font-size:9pt;" value="Agent Name:" xp:key="label"></xp:label>
</xp:this.facets>
</xe:formRow>
<xe:formRow id="formRow21">
<xp:div><xp:message id="msg05" for="wi_Origin"></xp:message></xp:div>
<xp:comboBox id="wi_Origin" style="font-size:9pt; height:19px; width:200px;"
value="#{WorkItem.wi_Origin}" required="true" disableClientSideValidation="true">
<xp:this.validators>
<xp:validateRequired
message="You must select a value.">
</xp:validateRequired>
</xp:this.validators>
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:@Text("") }]]></xp:this.value>
</xp:selectItems>
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:
var col = (sessionScope.lang == "fr" ? 8 : 7);
//var strKey = getComponent("wi_Project").getSubmittedValue();
var strKey = getComponent("wi_Project").getValue();
if (strKey != null) {
strKey.trim();
}
var items = @DbLookup(@DbName(),"VWL010",strKey,col,"[FAILSILENT]");
if (items != null) {
return items;
}}]]></xp:this.value>
</xp:selectItems>
</xp:comboBox>
<xp:this.facets>
<xp:label id="label18" style="font-weight:bold; font-size:9pt;" value="Origin:" xp:key="label"></xp:label>
</xp:this.facets>
</xe:formRow>
<xe:formRow id="formRow4"><xp:this.facets>
<xp:label value="Reason" id="label8" xp:key="label"
style="font-weight:bold; font-size:9pt;">
</xp:label></xp:this.facets>
<xp:div>
<xp:message id="message1" for="wi_Reason"></xp:message></xp:div>
<xp:comboBox id="wi_Reason"
value="#{WorkItem.wi_Reason}"
style="font-size:9pt; height:19px; width:200px;" required="true"
disableClientSideValidation="true">
<xp:this.validators>
<xp:validateRequired
message="You must select a value.">
</xp:validateRequired>
</xp:this.validators>
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:return "";}]]></xp:this.value>
</xp:selectItems>
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:var col = (sessionScope.lang == "fr" ? 12 : 11);
//var strKey = getComponent("wi_Project").getSubmittedValue();
var strKey = getComponent("wi_Project").getValue();
if (strKey != null) {
strKey.trim();
}
var items = @DbLookup(@DbName(),"VWL010",strKey,col,"[FAILSILENT]");
if (items != null) {
return items;
}}]]></xp:this.value>
</xp:selectItems>
<xp:eventHandler event="onchange" submit="true"
refreshMode="partial" refreshId="wi_Intervention"
immediate="true">
</xp:eventHandler>
</xp:comboBox></xe:formRow>
////////////INTERVENTION////////////////////////////
<xe:formRow id="formRow19">
<xp:div><xp:message id="msg06" for="wi_Intervention"></xp:message></xp:div>
<xp:comboBox id="wi_Intervention"
style="font-size:9pt; height:19px; width:200px;"
value="#{WorkItem.wi_Intervention}" required="true"
disableClientSideValidation="true">
<xp:this.validators>
<xp:validateRequired
message="You must select a value">
</xp:validateRequired>
</xp:this.validators>
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:@Text("")}]]></xp:this.value>
</xp:selectItems>
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:var col = (sessionScope.lang == "fr" ? 14 : 13);
var value = getComponent("wi_Reason").getSubmittedValue();
if (value != null) {
var value = value.trim();
return @DbLookup(@DbName(),"VWL010",value,col);
}
else{
};
}]]></xp:this.value>
</xp:selectItems>
</xp:comboBox>
<xp:this.facets>
<xp:label id="label6" style="font-weight:bold; font-size:9pt;" value="Intervention:" xp:key="label"></xp:label>
</xp:this.facets>
</xe:formRow>
<xe:formRow id="formRow3">
<xp:panel id="panelbroker">
<xp:this.rendered><![CDATA[#{javascript:
var strValue:String = getComponent("chkLinkedBroker").getValue();
getComponent("chkLinkedBroker").getValue()=="yes";
}]]>
</xp:this.rendered>
<xp:div><xp:message id="msg07" for="wi_brokercode"></xp:message></xp:div>
<xp:label id="label5" style="font-weight:bold; font-size:9pt;" value="Broker code:">
<xp:br />
<xp:inputText id="wi_brokercode"
value="#{WorkItem.brokercode}" style="width:100px;"
required="true" disableClientSideValidation="true">
<xp:this.validators>
<xp:validateRequired
message="Enter a number of max. six digits.">
</xp:validateRequired>
<xp:validateLength maximum="6"
minimum="1" message="Enter a number of max. six digits.">
</xp:validateLength>
</xp:this.validators>
</xp:inputText>
</xp:label>
</xp:panel>
</xe:formRow>
</xe:formColumn>
<xe:formRow id="formRow9">
<xp:div><xp:message id="msg09" for="document_form_body"></xp:message></xp:div>
<xp:inputTextarea value="#{WorkItem.wi_Comments}"
id="document_form_body"
style="width:464px; height:125px; font-size:9pt;" required="true"
disableClientSideValidation="true">
<xp:this.validators>
<xp:validateRequired
message="You must enter a comment.">
</xp:validateRequired>
</xp:this.validators>
</xp:inputTextarea>
<xp:this.facets>
<xp:label id="label1" value="Comments:" style="font-weight:bold; font-size:9pt;" xp:key="label"></xp:label>
</xp:this.facets>
</xe:formRow>
</xe:formTable>
</xp:panel>
<xp:eventHandler event="onHide" submit="true" refreshMode="partial" refreshId="tabbedPanel1"></xp:eventHandler>
</xe:dialog>
</xp:view>
答案 0 :(得分:0)
可能的原因是wi_intervention
组合框中的这一行getSubmittedValue()
。
submittedValue
仅用于验证器。如果您的代码不在条件验证器中-它不在此处-selectItems
将始终为null。如果您的代码位于控件的属性(例如getValue()
)或按钮中,则只需要getSubmittedValue()
。
有关何时使用getValue()
和list
以及更多内容的更多说明,请参见此处录制的网络研讨会https://youtu.be/t7j_MR5uzCA,位于此处记录的2016年网络研讨会标签上http://www.tlcc.com/admin/tlccsite.nsf/pages/recorded-xpages-webinars