0
votes

Step1: Added two input texts and a Button with save document server-side action to the xpage. By clicking on the button it saves the document.

Step 2. Set up one of the input texts as a dijit.form.ValidationTextBox. This automatically adds the '**parseOnLoad: true**' parameter to the page. The source of the page in the browser:

Step 3. Add the **required=true** parameter to the dijit.form.ValidationTextBox. The document still can be saved even the validationTextBox left empty.

Step 4. Add a numberspinner item from the Lotus Extension library to the xpage. This adds the **dojoType="dijit.form.Form"** attribute to the page and this prevents document save, if the inputvalidationtextbox is empty.

Step 4. Add a numberspinner item from the Lotus Extension library to the xpage. This adds the dojoType="dijit.form.Form" attribute to the page and this prevents document save, if the inputvalidationtextbox is empty. The source of the page in the browser:

    <!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>

My question is how to add a partial refresh, or submit function to the xpage, which can be executed, even empty required field. This is possible, until I add the dijit.form.NumberSpinner from the Extension Library.

1

1 Answers

0
votes
<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>