title: grails - returning Object or id from formRemote
body: <p>I have a grails app where, after a user enters a name for a new domain object (Sync), I want to save the object, move to a fragment on the same page, and change the css class of a div (to js colorbox, if that matters).  </p>
  
  <p>To do this, I use an anchor to set the class and move to the fragment and use JS to submit a g:formRemote. However, the formRemote does not return the created object.</p>
  
  <p>partial of gsp:</p>
  
  <pre><code>&lt;g:formRemote url="[controller: 'Main', action:'createNewSync']" name="newSyncForm"   &gt;
  &lt;g:field type="text" name="newSyncName" /&gt;
  
  &lt;a id="ns-link" href="#outline_content" class="outline"&gt;
  &lt;script&gt;
    $('#ns-link').click(function(){
       $('#newSyncForm').submit();
    });
   &lt;/script&gt;
   &lt;/g:formRemote&gt;
  </code></pre>
  
  <p>Later in the gsp, we want to move to use the colorbox with the outline_content inside. Notice the syncInstance.name is needed.</p>
  
  <pre><code>&lt;script&gt;
  $(document).ready(function(){
  $(".outline").colorbox({inline:true, width:"1140px", escKey:false, overlayClose:false});
  &lt;/script&gt;
  
  &lt;div id="sync" class="hidden"&gt;
  &lt;div id='outline_content' style='padding:10px; background:#fff;' &gt;
      &lt;h2 class="nameheader"&gt;&lt;strong style="color:#000;"&gt;New Sync:&lt;/strong&gt;&lt;span class="editable_textile"&gt;${syncInstance?.name}&lt;/span&gt;&lt;/h2&gt;
          &lt;div class="number1"&gt;&lt;img src="../images/1.png" border="0" /&gt;&lt;/div&gt;
  </code></pre>
  
  <p>.....</p>
  
  <p>controller: </p>
  
  <pre><code>def createNewSync(){
      params.name = params.newSyncName
      def syncInstance =  Sync?.findByName(params.newSyncName) 
  
  if (!syncInstance)
  {
          syncInstance = new Sync(params)
          def u = User.findByUsername(springSecurityService.principal)
          syncInstance.properties['createdBy'] = u
          syncInstance.properties['createdDate'] = new Date().toString()
          syncInstance.properties['lastRunTime'] = "Never"
          syncInstance.properties['lastRunOutcome'] = "---"
          syncInstance.properties['isScheduled'] = false
          syncInstance.properties['isComplete'] = false
  
          syncInstance.save(failOnError: true, flush: true)
  
      }        
      //doesn't send anything back to page if it's been called remotely
      [syncInstance: syncInstance]
  }   
  </code></pre>
  
  <p>Is there any way to get a reference to the created object to be used later on the page using this method? If not, is there another way to accomplish this?</p>