<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: one-to-many relationships in Grails forms</title>
	<atom:link href="http://www.2paths.com/2009/10/01/one-to-many-relationships-in-grails-forms/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.2paths.com/2009/10/01/one-to-many-relationships-in-grails-forms/</link>
	<description>Custom Software Technical Architecture, Design and Development in Vancouver, BC, Canada</description>
	<lastBuildDate>Fri, 20 Aug 2010 23:43:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Train of Thought &#124; Grails one-to-many dynamic forms</title>
		<link>http://www.2paths.com/2009/10/01/one-to-many-relationships-in-grails-forms/comment-page-1/#comment-18580</link>
		<dc:creator>Train of Thought &#124; Grails one-to-many dynamic forms</dc:creator>
		<pubDate>Fri, 20 Aug 2010 23:43:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.2paths.com/?p=1228#comment-18580</guid>
		<description>[...] to find a good way to implement one-to-many dynamic forms in Grails, I have finally come across this post which does a very good job at explaining the [...]</description>
		<content:encoded><![CDATA[<p>[...] to find a good way to implement one-to-many dynamic forms in Grails, I have finally come across this post which does a very good job at explaining the [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: omarello</title>
		<link>http://www.2paths.com/2009/10/01/one-to-many-relationships-in-grails-forms/comment-page-1/#comment-18498</link>
		<dc:creator>omarello</dc:creator>
		<pubDate>Thu, 19 Aug 2010 09:15:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.2paths.com/?p=1228#comment-18498</guid>
		<description>Tim, thanks a lot for this great tutorial. You just saved my life, can&#039;t wait to go back home and try this. I&#039;ve been looking all over for that sort of explanation. I really think this should be included somewhere in the grails docs.</description>
		<content:encoded><![CDATA[<p>Tim, thanks a lot for this great tutorial. You just saved my life, can&#8217;t wait to go back home and try this. I&#8217;ve been looking all over for that sort of explanation. I really think this should be included somewhere in the grails docs.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ballistic_realm</title>
		<link>http://www.2paths.com/2009/10/01/one-to-many-relationships-in-grails-forms/comment-page-1/#comment-18163</link>
		<dc:creator>ballistic_realm</dc:creator>
		<pubDate>Thu, 12 Aug 2010 18:41:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.2paths.com/?p=1228#comment-18163</guid>
		<description>Nice tutorial. Very helpful. Thanks</description>
		<content:encoded><![CDATA[<p>Nice tutorial. Very helpful. Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karol</title>
		<link>http://www.2paths.com/2009/10/01/one-to-many-relationships-in-grails-forms/comment-page-1/#comment-17154</link>
		<dc:creator>Karol</dc:creator>
		<pubDate>Sat, 24 Jul 2010 10:25:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.2paths.com/?p=1228#comment-17154</guid>
		<description>Hello! I&#039;m using your solution to make the a little complicated system, but to this later. When I was working on my version of yours _book.gsp the Netbeans shows me a little syntax error on line &quot; var deleteIcon = ${resource(dir:&#039;images/skin&#039;, file:&#039;database_delete.png&#039;)};&quot; - it says:
&quot;illegal string body character after dollar sign&quot;.

I was thinking it was some artifact from previous changes to files, but it&#039;s persistent and won&#039;t leave after reopenings the file. I use Netbeans 6.9 and Grails 1.3.3.

I have also next question - I need to make adding two, connected object with as one List element added to &quot;parent&quot; object. I have main class ( Author counterpart ) Wniosek that has many Osobowosc ( Identity ) and TypOsobowosci ( Type of Identity ), both as sperate classes, but both needed, as one &quot;record&quot; in List. How to make the similar solution to yours for two models object as one &quot;record&quot;? Make two rendering files I guess, but what inside the class itself?

End result should be like this:

Create Wniosek:

Typ: 

Osobowosci:  - 

                   - 

                  - 

                   etc.</description>
		<content:encoded><![CDATA[<p>Hello! I&#8217;m using your solution to make the a little complicated system, but to this later. When I was working on my version of yours _book.gsp the Netbeans shows me a little syntax error on line &#8221; var deleteIcon = ${resource(dir:&#8217;images/skin&#8217;, file:&#8217;database_delete.png&#8217;)};&#8221; &#8211; it says:<br />
&#8220;illegal string body character after dollar sign&#8221;.</p>
<p>I was thinking it was some artifact from previous changes to files, but it&#8217;s persistent and won&#8217;t leave after reopenings the file. I use Netbeans 6.9 and Grails 1.3.3.</p>
<p>I have also next question &#8211; I need to make adding two, connected object with as one List element added to &#8220;parent&#8221; object. I have main class ( Author counterpart ) Wniosek that has many Osobowosc ( Identity ) and TypOsobowosci ( Type of Identity ), both as sperate classes, but both needed, as one &#8220;record&#8221; in List. How to make the similar solution to yours for two models object as one &#8220;record&#8221;? Make two rendering files I guess, but what inside the class itself?</p>
<p>End result should be like this:</p>
<p>Create Wniosek:</p>
<p>Typ: </p>
<p>Osobowosci:  &#8211; </p>
<p>                   &#8211; </p>
<p>                  &#8211; </p>
<p>                   etc.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: RCachATX</title>
		<link>http://www.2paths.com/2009/10/01/one-to-many-relationships-in-grails-forms/comment-page-1/#comment-16200</link>
		<dc:creator>RCachATX</dc:creator>
		<pubDate>Fri, 25 Jun 2010 05:00:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.2paths.com/?p=1228#comment-16200</guid>
		<description>Worked in Grails 1.3.2 on first try.  Awesome! Thanks so much.</description>
		<content:encoded><![CDATA[<p>Worked in Grails 1.3.2 on first try.  Awesome! Thanks so much.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Federico</title>
		<link>http://www.2paths.com/2009/10/01/one-to-many-relationships-in-grails-forms/comment-page-1/#comment-15896</link>
		<dc:creator>Federico</dc:creator>
		<pubDate>Tue, 15 Jun 2010 17:34:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.2paths.com/?p=1228#comment-15896</guid>
		<description>Sorry, just to clarify, I meant &quot;authorInstance.books[i]._deleted&quot; in point (1)</description>
		<content:encoded><![CDATA[<p>Sorry, just to clarify, I meant &#8220;authorInstance.books[i]._deleted&#8221; in point (1)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Federico</title>
		<link>http://www.2paths.com/2009/10/01/one-to-many-relationships-in-grails-forms/comment-page-1/#comment-15895</link>
		<dc:creator>Federico</dc:creator>
		<pubDate>Tue, 15 Jun 2010 17:30:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.2paths.com/?p=1228#comment-15895</guid>
		<description>Tim, thanks for the great post. Really helpful - exactly what I was looking for.

A couple of issues I found when I tried the example (might be because I used Grails 1.3.1):
(1) After saving an author with books, I couldn&#039;t delete books from the list (they&#039;d remain in the database). After debugging I found that the &quot;authorInstance.properties = params&quot; was not working correctly (the &quot;_deleted&quot; request parameter would be set to true, but the corresponding &quot;authorInstance._deleted&quot; property was always set to false). I changed &quot;_deleted&quot; to &quot;deleted&quot; (i.e. removed the underscore in the domain class &amp; corresponding GSPs) then the code worked fine. I&#039;m not sure why the underscore was causing an issue but it could be something weird relating to  Grails 1.3.1.
(2) After I got (1) working, I ran into another issue. If I created, say, 3 NEW books (BookA, BookB and BookC in that order), then immediately remove BookB BEFORE hitting &quot;save/update&quot;, Grails actually persists BookA with an index field of 0 and BookC with an index field of 2 (instead of shifting BookC up to position 1 which would make more sense since B never really existed). I found the index &quot;gap&quot; was then causing issues when going to re-edit that particular author since Grails starts trying to retrieve book[2] from a collection of just two items.

There are a couple of ways round the 2nd issue - what I did was treat new books the same as existing ones (i.e. instead of calling &quot;.remove()&quot; in the GSP like you&#039;d done, I kept a hidden &quot;deleted&quot; field for both existing AND new books, then called &quot;hide()&quot; in both cases when a book needed to be marked for deletion). Only thing is this means you DO have to ensure you include the same &quot;authorInstance.books.removeAll(_toBeDeleted)&quot; logic in your controller &quot;save()&quot; method as well (otherwise you can potentially end up with index &quot;gaps&quot; again).</description>
		<content:encoded><![CDATA[<p>Tim, thanks for the great post. Really helpful &#8211; exactly what I was looking for.</p>
<p>A couple of issues I found when I tried the example (might be because I used Grails 1.3.1):<br />
(1) After saving an author with books, I couldn&#8217;t delete books from the list (they&#8217;d remain in the database). After debugging I found that the &#8220;authorInstance.properties = params&#8221; was not working correctly (the &#8220;_deleted&#8221; request parameter would be set to true, but the corresponding &#8220;authorInstance._deleted&#8221; property was always set to false). I changed &#8220;_deleted&#8221; to &#8220;deleted&#8221; (i.e. removed the underscore in the domain class &amp; corresponding GSPs) then the code worked fine. I&#8217;m not sure why the underscore was causing an issue but it could be something weird relating to  Grails 1.3.1.<br />
(2) After I got (1) working, I ran into another issue. If I created, say, 3 NEW books (BookA, BookB and BookC in that order), then immediately remove BookB BEFORE hitting &#8220;save/update&#8221;, Grails actually persists BookA with an index field of 0 and BookC with an index field of 2 (instead of shifting BookC up to position 1 which would make more sense since B never really existed). I found the index &#8220;gap&#8221; was then causing issues when going to re-edit that particular author since Grails starts trying to retrieve book[2] from a collection of just two items.</p>
<p>There are a couple of ways round the 2nd issue &#8211; what I did was treat new books the same as existing ones (i.e. instead of calling &#8220;.remove()&#8221; in the GSP like you&#8217;d done, I kept a hidden &#8220;deleted&#8221; field for both existing AND new books, then called &#8220;hide()&#8221; in both cases when a book needed to be marked for deletion). Only thing is this means you DO have to ensure you include the same &#8220;authorInstance.books.removeAll(_toBeDeleted)&#8221; logic in your controller &#8220;save()&#8221; method as well (otherwise you can potentially end up with index &#8220;gaps&#8221; again).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim</title>
		<link>http://www.2paths.com/2009/10/01/one-to-many-relationships-in-grails-forms/comment-page-1/#comment-15829</link>
		<dc:creator>Tim</dc:creator>
		<pubDate>Sun, 13 Jun 2010 02:58:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.2paths.com/?p=1228#comment-15829</guid>
		<description>LA, I&#039;m not sure I follow your example, but at first glance it sounds like it should be fine. You&#039;d just do the same thing for the book class so it can edit the pages inline.</description>
		<content:encoded><![CDATA[<p>LA, I&#8217;m not sure I follow your example, but at first glance it sounds like it should be fine. You&#8217;d just do the same thing for the book class so it can edit the pages inline.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: LA</title>
		<link>http://www.2paths.com/2009/10/01/one-to-many-relationships-in-grails-forms/comment-page-1/#comment-15165</link>
		<dc:creator>LA</dc:creator>
		<pubDate>Tue, 25 May 2010 18:05:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.2paths.com/?p=1228#comment-15165</guid>
		<description>will this &quot;pattern&quot; work if the Book has many &quot;Pages&quot; (dummy example)?</description>
		<content:encoded><![CDATA[<p>will this &#8220;pattern&#8221; work if the Book has many &#8220;Pages&#8221; (dummy example)?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vnug</title>
		<link>http://www.2paths.com/2009/10/01/one-to-many-relationships-in-grails-forms/comment-page-1/#comment-14640</link>
		<dc:creator>vnug</dc:creator>
		<pubDate>Tue, 04 May 2010 05:51:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.2paths.com/?p=1228#comment-14640</guid>
		<description>Nevermind .... the problem was the syntax was changed for 1.2 for adding jquery plugin.

Instead of (in main.gsp under layouts) - 
 

It should be -
 

Thanks.</description>
		<content:encoded><![CDATA[<p>Nevermind &#8230;. the problem was the syntax was changed for 1.2 for adding jquery plugin.</p>
<p>Instead of (in main.gsp under layouts) &#8211; </p>
<p>It should be -</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
