2013-02-06 55 views
0

我有一個xapage,我創建了佈局表單等。當我用它創建一個新文檔時,它不保存文檔。但是,如果我編輯使用筆記形式創建的現有文檔,它確實可以保存該文檔。這很奇怪。沒有任何錯誤消息,它只是用空字段重新加載文檔。以下是我的源代碼:xpage文檔不會保存新文檔,但會保存已編輯的現有文檔

<?xml version="1.0" encoding="UTF-8"?> 
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" 
    xmlns:xe="http://www.ibm.com/xsp/coreex" 
    xmlns:xc="http://www.ibm.com/xsp/custom"> 

    <xp:this.data> 
     <xp:dominoDocument var="document1" action="openDocument" 
      formName="frmComm" computeWithForm="onsave"> 
     </xp:dominoDocument> 
    </xp:this.data> 

    <xp:this.dataContexts> 
    <xp:dataContext var="parentDoc"> 
     <xp:this.value><![CDATA[#{javascript: 
      try { 
       if (document1.isResponse()) { 
        return database.getDocumentByUNID(document1.getDocument().getParentDocumentUNID()); 
       } else { 
        return ""; 
       } 
      } catch(e) { 
       return ""; 
     }}]]></xp:this.value> 
    </xp:dataContext> 
</xp:this.dataContexts> 



    <xc:AppLayout> 
     <xp:this.facets> 
      <xp:panel xp:key="facetMiddle"> 

       <xp:panel> 
        <xc:ccFormActions></xc:ccFormActions> 

        <xp:panel> 
         <xp:panel><xe:formTable id="formTable1" formTitle="Communication"> 
     <xe:formColumn id="formColumn2"> 
      <xe:formRow id="formRow14" label="Policy Name:" rendered="#{javascript:document1.isEditable()}"> 
       <xp:inputText id="inputText1" value="#{document1.NameC}" 
        style="width:630.0px" 
        rendered="#{javascript:document1.isEditable()}" readonly="true"> 
       <xp:this.defaultValue><![CDATA[#{javascript:parentDoc.getItemValueString("Name"); 
}]]></xp:this.defaultValue></xp:inputText> 
      </xe:formRow> 
      <xe:formRow id="formRow11" label="Policy Name:" rendered="#{javascript:!document1.isEditable()}"> 
       <xp:text escape="true" id="NameV" value="#{document1.NameC}" rendered="#{javascript:!document1.isEditable()}"> 
       </xp:text> 

      </xe:formRow> 
      <xe:formRow id="formRow12" label="Policy Number:" rendered="#{javascript:document1.isEditable()}"> 
       <xp:inputText id="inputText4" value="#{document1.NbrC}" rendered="#{javascript:document1.isEditable()}" readonly="true"> 
       <xp:this.defaultValue><![CDATA[#{javascript:parentDoc.getItemValueString("Nbr");}]]></xp:this.defaultValue></xp:inputText> 
      </xe:formRow> 
      <xe:formRow id="formRow13" label="Policy Number:" rendered="#{javascript:!document1.isEditable()}"> 
       <xp:text escape="true" id="NbrV" value="#{document1.NbrC}" rendered="#{javascript:!document1.isEditable()}"> 
       </xp:text> 

      </xe:formRow> 
      <xe:formRow id="formRow10" label="Category:" rendered="#{javascript:document1.isEditable()}"> 
       <xp:inputText id="inputText5" style="width:169.0px" value="#{document1.CategoryC}" rendered="#{javascript:document1.isEditable()}" readonly="true"> 
       <xp:this.defaultValue><![CDATA[#{javascript:parentDoc.getItemValueString("Category");}]]></xp:this.defaultValue></xp:inputText> 
      </xe:formRow> 
      <xe:formRow id="formRow9" label="Category:" rendered="#{javascript:!document1.isEditable()}"> 
       <xp:text escape="true" id="CategoryV" value="#{document1.CategoryC}" rendered="#{javascript:!document1.isEditable()}"> 
       </xp:text> 

      </xe:formRow> 
      <xe:formRow id="formRow8" label="Sub Category:" rendered="#{javascript:document1.isEditable()}"> 
       <xp:inputText id="inputText7" value="#{document1.SubCategoryC}" rendered="#{javascript:document1.isEditable()}" readonly="true"> 
       <xp:this.defaultValue><![CDATA[#{javascript:parentDoc.getItemValueString("SubCategory");}]]></xp:this.defaultValue></xp:inputText> 
      </xe:formRow> 
      <xe:formRow id="formRow1" label="Sub Category:" rendered="#{javascript:!document1.isEditable()}"> 
       <xp:text escape="true" id="SubCategoryV" value="#{document1.SubCategoryC}" rendered="#{javascript:!document1.isEditable()}"> 
       </xp:text> 

      </xe:formRow> 
      <xe:formRow id="formRow2" label="Quarter/Year:" rendered="#{javascript:document1.isEditable()}"> 
       <xp:comboBox id="comboBox1" value="#{document1.ComQtr}" style="margin-right:10.0px" rendered="#{javascript:document1.isEditable()}"> 
        <xp:selectItem itemLabel="Q1"></xp:selectItem> 
        <xp:selectItem itemLabel="Q2"></xp:selectItem> 
        <xp:selectItem itemLabel="Q3"></xp:selectItem> 
        <xp:selectItem itemLabel="Q4"></xp:selectItem> 
       </xp:comboBox> 
       <xp:comboBox id="comboBox2" value="#{document1.ComYr}" 
        rendered="#{javascript:document1.isEditable()}" 
        style="width:58.0px"> 




        <xp:selectItems> 
         <xp:this.value><![CDATA[#{javascript:var profDoc:NotesDocument = database.getProfileDocument("configdoc",""); 

return 
profDoc.getItemValue("cfgCYear");}]]></xp:this.value> 
        </xp:selectItems> 
       </xp:comboBox> 
      </xe:formRow> 
      <xe:formRow id="formRow3" label="Quarter/Year:" rendered="#{javascript:!document1.isEditable()}"> 
       <xp:text escape="true" id="QtrYr" rendered="#{javascript:!document1.isEditable()}"><xp:this.value><![CDATA[#{javascript:document1.getItemValueString("ComQtr") + " " + document1.getItemValueString("ComYr")}]]></xp:this.value></xp:text> 

      </xe:formRow> 
      <xe:formRow id="formRow4" label="Date:"> 
       <xp:inputText id="inputText2" 
        value="#{document1.ComDt}"> 
        <xp:this.converter> 
         <xp:convertDateTime type="date" 
          dateStyle="short"> 
         </xp:convertDateTime> 
        </xp:this.converter> 
        <xp:dateTimeHelper></xp:dateTimeHelper> 
       </xp:inputText> 
      </xe:formRow> 
      <xe:formRow id="formRow5" label="Activity"> 
       <xp:inputTextarea id="inputTextarea1" 
        style="width:413.0px;height:84.0px" value="#{document1.ComActivity}"> 
       </xp:inputTextarea> 
      </xe:formRow> 
      <xe:formRow id="formRow6" label="Comments:"> 
       <xp:inputRichText id="inputRichText1" value="#{document1.ComComments}"></xp:inputRichText>    
      </xe:formRow> 
      <xe:formRow id="formRow7" label="Edit Policy Information:"> 
       <xp:checkBox text="Edit" id="checkBox1" value="#{document1.EditPol}" checkedValue="Edit"></xp:checkBox> 

      </xe:formRow> 
     </xe:formColumn> 

    </xe:formTable></xp:panel> 
        </xp:panel> 
       </xp:panel> 
      </xp:panel> 
     </xp:this.facets> 

    </xc:AppLayout><xp:this.navigationRules><xp:navigationRule outcome="xsp-failure" viewId="/communications.xsp"></xp:navigationRule></xp:this.navigationRules></xp:view> 
+2

您有權在ACL中創建文檔嗎? – stwissel

+1

這是一個代碼示例很多東西。如果你的ACL是好的,我建議你嘗試用最少量的元素和代碼重現問題。 –

+3

如果更改數據的默認操作以創建新文檔而不是openDocument,該怎麼辦?然後會發生什麼? –

回答

1

這已解決。與經典筆記開發不同,如果表單屬性設置爲文檔而不是響應,則在使用動作創建響應時不會保存文檔。因此,將屬性更改爲響應可解決問題。

+1

很棒,你找到它了。我相信沒有'computeWithForm =「保存」'它會起作用。 –

+0

謝謝,我今天晚上還會去探索那條大道。 –

+0

@PanuHaaramo,你是正確的,移除計算與表單的作品也是如此。也謝謝你 –