0

第 1 步:向 xpage 添加两个输入文本和一个带有保存文档服务器端操作的按钮。通过单击按钮,它会保存文档。

步骤 2. 将输入文本之一设置为 dijit.form.ValidationTextBox。这会自动将 '**parseOnLoad: true**' 参数添加到页面。浏览器中页面的来源:

步骤 3. 将 **required=true** 参数添加到 dijit.form.ValidationTextBox。即使validationTextBox 留空,文档仍然可以保存。

步骤 4. 将 Lotus Extension 库中的 numberspinner 项目添加到 xpage。这会在页面中添加 **dojoType="dijit.form.Form"** 属性,如果 inputvalidationtextbox 为空,则会阻止文档保存。

步骤 4. 将 Lotus Extension 库中的 numberspinner 项目添加到 xpage。如果 inputvalidationtextbox 为空,这会将 dojoType="dijit.form.Form" 属性添加到页面并防止文档保存。浏览器中页面的来源:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="hu">
<head>
<script type="text/javascript">if(!navigator.cookieEnabled)window.location.href='http://localhost/development/Labor/labor.nsf/test1.xsp?SessionID=D937UTFGVR';</script>
<title></title>
<link rel="stylesheet" type="text/css" href="/xsp/.ibmxspres/.mini/css/@Da&amp;@Ib&amp;2Tfxsp.css&amp;2TfxspLTR.css&amp;2TfxspFF.css.css">
<script type="text/javascript" src="/xsp/.ibmxspres/dojoroot-1.6.1/dojo/dojo.js" djConfig="locale: 'hu-hu', parseOnLoad: true"></script>
<script type="text/javascript" src="/xsp/.ibmxspres/.mini/dojo/.hu-hu/@Fi&amp;@Fo&amp;@Iq.js"></script>
</head>
<body class="xspView tundra">
<form id="view:_id1" method="post" action="/development/Labor/labor.nsf/test1.xsp" class="xspForm" enctype="multipart/form-data" dojoType="dijit.form.Form">
<input type="text" dojoType="dijit.form.ValidationTextBox" required="true" id="view:_id1:inputText1" name="view:_id1:inputText1" class="xspInputFieldEditBox"><button class="xspButtonCommand" type="button" name="view:_id1:button1" id="view:_id1:button1">Label</button><br>
<input type="text" id="view:_id1:inputText2" name="view:_id1:inputText2" class="xspInputFieldEditBox"><input dojoType="dijit.form.NumberSpinner" id="view:_id1:djNumberSpinner1" name="view:_id1:djNumberSpinner1">
<input type="hidden" name="$$viewid" id="view:_id1__VUID" value="!d937utjhyk!">
<input type="hidden" name="$$xspsubmitid">
<input type="hidden" name="$$xspexecid">
<input type="hidden" name="$$xspsubmitvalue">
<input type="hidden" name="$$xspsubmitscroll">
<input type="hidden" name="view:_id1" value="view:_id1"></form>
<script type="text/javascript">
XSP.addOnLoad(function() {
XSP.attachEvent("view:_id1:_id2", "view:_id1:button1", "onclick", null, true, 2);
}); 
</script>
</body>
</html>

我的问题是如何向xpage添加部分刷新,或者提交功能,可以执行,甚至是空的必填字段。这是可能的,直到我从扩展库中添加 dijit.form.NumberSpinner。

4

1 回答 1

0
<form id="view:_id1" 
  method="post" 
  action="/development/Labor/labor.nsf/test1.xsp" 
  class="xspForm" enctype="multipart/form-data" 
  dojoType="dijit.form.Form">
<script type="dojo/method" event="submit">

     if(!this.validate()) {

          dojo.xhrPost({ url: form.get("action"), content: form.getValues() }).then(
              function() { /* successor */ }, 
              function() { /* errorhandle */ }
           );
     }
     else {

           this.containerNode.submit();
     }
</script>

 <!-- ... -->
</form>
于 2012-08-27T09:45:05.690 回答