Oct 20, 2011, 9:48 AM
66 Posts

How to prevent Domino to switch document to edit mode based on my condition?

  • Category: Other
  • Platform: All
  • Release: 8.5.3
  • Role:
  • Tags:
  • Replies: 2
 How to prevent Domino to switch document to edit mode based on my condition? I have a list of documents, user opens the document in read mode (action=openDocument) and there is a button for switching document into edit mode. The button is created using Simple action and 'Change document mode' (this way Domino switches to edit mode using post method without changing the url to action=EditDocument ). I would like to prevent user to edit some documents despite the fact that he has an authors access. In standard Lotus Notes I ussualy place some conditions into PostOpen event and then close document, when condition is not being passed. In xPages, I tried here to place condition and context.redirectToPage code into 'beforeRenderResponse' event, but the redirect do not occur and there is no message on console. How should I accomplish requested behaviour?
 
Thanks!! 
Oct 21, 2011, 3:20 AM
261 Posts
Re: How to prevent Domino to switch document to edit mode based on my condition?
David,
 
How about setting the ignoreRequestParams parameter on the data source to true and then building your own logic to determine if the doument should be displayed in read or edit mode?
 
Mark
Oct 21, 2011, 7:12 AM
272 Posts
Re: How to prevent Domino to switch document to edit mode based on my condition?
Hi,
 
you could use an action group and compute the condition:
 
<xp:button value="Label" id="button2">
   <xp:eventHandler event="onclick" submit="true" refreshMode="complete">
      <xp:this.action>
         <xp:actionGroup>
            <xp:this.condition>
               <![CDATA[#{javascript:if( document1.getItemValueString("author").equals("123") ) return true;
               return false
               }]]>
            </xp:this.condition>
            <xp:changeDocumentMode mode="toggle"></xp:changeDocumentMode>
         </xp:actionGroup>
      </xp:this.action>
   </xp:eventHandler>
</xp:button>
 
 
Hope this helps
Sven