Nothing happens. There are no errors or anything, and after I call save() on
the iterator, it still shows that it contains the right information, but the
link table is never updated. I should mention that I'm using the latest SVN
build, am running in development mode, and I cleared out my project files.

Okay, I just tried something that may shed light on the problem (and on new
ones, no doubt :)) If I call save() on the Room records, the data in the
iterator is saved. Also, if I alter a property of the Room record (via the
form or otherwise) and then call save on the Profile record, the iterator is
saved properly. However, if I submit the form without making any changes, or
*only* selecting Products from the select list, the data from the iterator
is erased from the database.

I think I need to deconstruct my form logic, I'm obviously missing something
here. I'll work up a much simpler test case.

On 1/30/07, Doug Hughes <[EMAIL PROTECTED]> wrote:

What happens if you call save() directly on the iterator?

Doug

On 1/30/07, Ken Dunnington <[EMAIL PROTECTED] > wrote:

> I'm trying to add/update a linked relationship, but am having some
> trouble. I can add records to the iterator and verify they are the correct
> ones, but calling save() on the parent record doesn't seem to work. My
> config looks like this:
>
>         <object name="Profile">
>             <hasMany name="Room">
>                 <relate from="id" to="profileID" />
>             </hasMany>
>         </object>
>         <object name="Room">
>             <field source="roomType" field="value" alias="typeName" />
>             <hasOne name="Profile">
>                 <relate from="profileID" to="id" />
>             </hasOne>
>             <hasOne name="roomType">
>                 <relate from="type" to="id" />
>             </hasOne>
>             <hasMany name="Product">
>                 <link name="roomItems" />
>             </hasMany>
>         </object>
>         <object name="roomItems">
>             <hasOne name="Room">
>                 <relate from="roomID" to="id" />
>             </hasOne>
>             <hasOne name="Product">
>                 <relate from="productID" to="id" />
>             </hasOne>
>         </object>
>
> I have a multi-select list in my form that displays all Products, and
> I'm handling the commit in my controller for now (this is where my
> fileService lives, and there are multiple file uploads.) This is how I'm
> adding Product records to the Room object's Iterator:
>
>     mainRoom.getProductIterator().add(id=allValues[name])
> where allValues[name] traces out to the ID of the Product I select in
> the form. I can then verify this works like so:
>
>     arguments.event.trace("Main: Product Name",
>         mainRoom.getProductIterator().getNext().getName())
>
> This room record is obtained from a profile record which is working
> fine, so I don't understand why, when I call profile.save(), it's not
> cascading down to the productIterator. The other values in the Room records
> are saving properly. Anyone have any thoughts on what I'm doing wrong?
>
> --
> Suppose you were an idiot. And suppose you were a member of congress.
> But I repeat myself.
> -- Mark Twain
>
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> -- -- --
> Reactor for ColdFusion Mailing List
> [email protected]
> Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> -- -- --




--
Doug Hughes
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --




--
Suppose you were an idiot. And suppose you were a member of congress. But I
repeat myself.
-- Mark Twain


-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Reply via email to