1.在表单的JS Header中写判断的javascript函数:
var request;
function checkloginname(){ request = new ActiveXObject("Msxml2.XMLHTTP")if (!request){ request=new ActiveXObject("Microsoft.XMLHTTP");} request.onreadystatechange=aftercheckloginname;//这里假设数据库路径为mis/accounts.nsf,且表单中输入帐号的域是account,将这个域的值传递到代理中
url="/mis/accounts.nsf/checkRepeatId?openagent&Id="+document.forms[0].account.value; request.open("post",url,true); request.send(null);}function aftercheckloginname(){ if (request.readystate==4){ if (request.status==200){ if (request.responseText.indexOf("1")>-1){ alert (" 对不起,该帐号已经被使用!"); document.forms[0].account.value=""; document.forms[0].account.focus(); } }}}2.新建一个checkRepeatId的代理:
Sub Initialize
Dim ss As New NotesSessionDim doc,docx As NotesDocumentDim view As NotesViewDim db As NotesDatabaseSet doc=ss.DocumentContextSet db=ss.CurrentDatabaseSet view=db.GetView("checkid") '这个试图即为帐号的试图,试图第一列为帐号macro=|@RightBack(Query_String_Decoded;"=")| '这句是获取从URL传过来的参数id=Evaluate(macro,doc)
Set docx=view.GetDocumentByKey(id(0),True)Print "Content-type: text/xml"If Not docx Is Nothing Then Print "1"Else Print "0"End IfEnd Sub3.在表单中输入帐号的域,这里举例为account,在域的onchange或者onblur事件中调用javascript方法checkloginname()