title: Spring *{} fields in a thymeleaf ajax tile
body: <p>I wonder if anyone can help. </p>
  
  <p>I am working on a Spring/Webflow/Tiles/Thymeleaf project. All is going reasonably well. We have tiles which represent the data entry forms, typically like this: </p>
  
  <pre><code>&lt;form th:object="${questionnaire}"&gt;
      .... 
      &lt;select th:field="*{title}&gt;
          &lt;option ..... 
      &lt;/select&gt;
      .... 
      &lt;input th:field="*{fname}" /&gt;
      &lt;input th:field="*{lastname}" /&gt;
      .... 
  &lt;/form&gt;
  </code></pre>
  
  <p>This is working well. But now we are trying to add some ajax magic to the form. Basically the idea is that when a button is pressed it triggers a webflow transition which will render its response in a tile. This is all working well ... expect the content of the fragment tile. The idea is that the new fragment will be some extra form fields. Something like this: </p>
  
  <pre><code>&lt;div tiles:fragment="moreDetails"&gt;
      .... 
      &lt;input th:field="*{phone}" /&gt;
      &lt;input th:field="*{email}" /&gt;
      .... 
  &lt;/div&gt;
  </code></pre>
  
  <p>The webflow and tiles part is working, but when thymeleaf tries to render the tile, it complains that the form fields refer to properties with *{} syntax, but not enclosed in a form tag with th:object </p>
  
  <p>So far we've come up with only 2 workarounds. We can put the form tag with th:object in the fragment tile, but this means we have a nested form in the resultant page :( 
  The other thing we've found we can do is simply write the input fields in the fraement with a name attribute rather than th:field 
  Both 'solutions' feel wrong </p>
  
  <p>Does anyone know if there is a better, more thymeleaf friendly way of doing this? </p>
  
  <p>Cheers </p>
  
  <p>Nathan</p>