如何解决Xpages - 通过按钮单击时 JS 代码无法执行
我有一个奇怪的问题,我有一个简单的 javascript 按钮,该调用的 1 函数用于写入一些文档历史记录并替换一个字段的值。然后它对容器 div ID 进行部分更新。
此按钮在通过英国访问时可以正常工作,但是当瑞士同事使用时,该按钮不起作用。
我有 1 个实例,目睹它不适用于 1 个用户,只是在当天晚些时候突然工作,所以我对可能是什么问题感到困惑。
按钮代码
<xp:button id="btnProceed" styleClass="btn btn-primary" value="Proceed">
<xp:this.disabled><![CDATA[#{javascript:try{
if (getComponent("chkConfirmed").getValue() == "false") {
return true;
} else {
return false;
}
}catch(e){
openLogBean.addError(e,this);
}
}]]></xp:this.disabled>
<xp:eventHandler event="onclick" submit="true" refreshMode="partial"
refreshId="contentWhiteBackground">
<xp:this.action><![CDATA[#{javascript:var dt = new Date();
var arrHistory:array = AddindepConfirmationHistoryItem(currentDocument,dt,"Confirmed understanding of the opening guidance",userBean.displayName);
document1.replaceItemValue("showIntroduction","2");
document1.save();
}]]></xp:this.action>
</xp:eventHandler></xp:button>
Sub AddindepConfirmationHistoryItem(confdoc As Notesdocument,dt As Variant,action As String,usrname As String)
Dim hlist As StringList
If Len(confdoc.History(0)) = 0 Then
confdoc.History = IndepConfirmationHistoryItem(dt,action,usrname)
Else
Set hlist = New StringList(confdoc.History,"")
Call hlist.Append(IndepConfirmationHistoryItem(dt,usrname))
confdoc.History = hlist.Items
End If
End Sub
编辑:
function AddindepConfirmationHistoryItem(doc,username){
var ArrDocHistory:array = doc.getItemValueArray("History");
var dateTimeFormat = new java.text.SimpleDateFormat("dd/MM/yyyy kk:mm");
var dateTimeString = dateTimeFormat.format(dt);
if(ArrDocHistory.length < 1){
// This should always return an object as it is created when an objectives document is first
// created but do this check to be safe and create an array if for some reason it doesnt exist
ArrDocHistory = [dateTimeString+"|"+action+"|"+username];
}else{
// append new value to the array
ArrDocHistory.push(dateTimeString+"|"+action+"|"+username);
}
doc.replaceItemValue("History",ArrDocHistory);
doc.replaceItemValue("LastUpdatedByName",username);
doc.replaceItemValue("LastUpdatedDate",dt);
//doc.Save();
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。