title: xpages set value to field before action=newDocument
body: <p>I have a simple button with the eventHandler:</p>
  
  <pre><code>&lt;xp:eventHandler event="onclick" submit="true" refreshMode="complete"&gt;
          &lt;xp:this.action&gt;
              &lt;xp:openPage target="newDocument" name="/doc.xsp"&gt;&lt;/xp:openPage&gt;
          &lt;/xp:this.action&gt;
  &lt;/xp:eventHandler&gt;
  </code></pre>
  
  <p>In <code>lotusScript</code> I would add a value to a field, before composing the form, using:</p>
  
  <pre><code>Call doc_new.ReplaceItemValue("txt_codformularmain","01")
  ....
  ....
  Set uidoc = w.EditDocument ( True, doc_new )  
  </code></pre>
  
  <p>I tried in the <code>postNewDocument</code> event of the <code>doc.xsp</code></p>
  
  <pre><code>&lt;xp:this.data&gt;
      &lt;xp:dominoDocument var="Contr" formName="(fmFormularCIP)"&gt;
          &lt;xp:this.postNewDocument&gt;&lt;![CDATA[#{javascript:Contr.replaceItemValue("txt_codformularmain", "01")}]]&gt;&lt;/xp:this.postNewDocument&gt;&lt;/xp:dominoDocument&gt;
  &lt;/xp:this.data&gt;
  </code></pre>
  
  <p>I don't want every time the doc is created that value to be, let say, <code>01</code>, BUT only when the doc. is composed by a specific button. Some other button will have the chance to add the <code>02</code> value for that field, and so on.</p>
  
  <p>How can I achieve this in xpages development? Thanks for your time.</p>