zoukankan      html  css  js  c++  java
  • Domino中运用ajax判断帐号是否存在的简单例子

     举例为帐号申请单,在开单的时输入一个帐号,系统判断该帐号是否存在于系统中。

    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 NotesSession
    Dim doc,docx As NotesDocument
    Dim view As NotesView
    Dim db As NotesDatabase

    Set doc=ss.DocumentContext
    Set db=ss.CurrentDatabase
    Set 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 If
    End Sub

    3.在表单中输入帐号的域,这里举例为account,在域的onchange或者onblur事件中调用javascript方法checkloginname()

  • 相关阅读:
    leetCode
    Autorelease Pool
    YYKit源码阅读
    读AVFoundation官方文档记录
    leetCode
    LeetCode
    图像灰度值 灰度值与像素值的关系
    CycloneII特殊管脚的使用(转)
    MOS管正确选择的步骤
    运算放大器单电源应用中的使用齐纳二极管偏置方法
  • 原文地址:https://www.cnblogs.com/hannover/p/2328936.html
Copyright © 2011-2022 走看看