title: Creating a response document via a button
body: <p>I have two forms, Organisation and Contact. Contact is a response to Org, and each form has an XPage where the form can be filled in, saved etc. When opening edit_contact.xsp directly and creating a document (not as a response to an org), everything works fine. </p>
  
  <p>On edit_org.xsp, I have a button with 2 events. The first copies some values into sessionScope so I can inherit them into the Contact. The second is a "Create Response Document" event which creates a new response with the parent ID being the current org document, and sends the user to edit_contact.xsp. Pressing the button changes XPage correctly and the field inheritance works fine, but pressing "Submit" on the Contact form doesn't save anything, and no document is created.</p>
  
  <p>This exact same setup works 100% as desired in another database, I have no idea why it won't work properly here. Is there an obscure setting somewhere I am missing?</p>
  
  <pre><code>&lt;xp:button value="Create Contact" id="button1" rendered="#{javascript:!document1.isEditable()}"&gt;
  &lt;xp:eventHandler event="onclick" submit="true" refreshMode="complete"&gt;
      &lt;xp:this.action&gt;
          &lt;xp:actionGroup&gt;
              &lt;xp:executeScript&gt;
                  &lt;xp:this.script&gt;
                      &lt;![CDATA[#{javascript:var doc = document1.getDocument();
  
                      sessionScope.PFirstName = doc.getFirstItem("P_Firstname").getValueString(); 
                      sessionScope.PSurname = doc.getFirstItem("P_Surname").getValueString(); 
                      sessionScope.PFamily = doc.getFirstItem("P_Family").getValueString(); 
                      sessionScope.PDOB = doc.getFirstItem("P_DOB") 
                      sessionScope.PAGE = doc.getFirstItem("P_Age").getValueString();}]]
                  &lt;/xp:this.script&gt;
              &lt;/xp:executeScript&gt;
                  &lt;xp:createResponse name="/edit_contact.xsp" parentId="#{javascript:document1.getNoteID()}"&gt;
                  &lt;/xp:createResponse&gt;
  
          &lt;/xp:actionGroup&gt;
      &lt;/xp:this.action&gt;
  &lt;/xp:eventHandler&gt;
  &lt;/xp:button&gt;`
  </code></pre>
  
  <p>Here is a link that shows what I am trying to do (minus the field inheritance):</p>
  
  <p><a href="http://min.us/mKSJED8tT" rel="nofollow">http://min.us/mKSJED8tT</a></p>
  
  <p>Currently the forms and views all work, but the document created with the "Response" form appears not to be a response document - it has no $REF field. This setup works perfectly in a different database  - what is going on?</p>