On Tue, Feb 21, 2006 at 01:11:22AM -0500, Kevin Davis wrote:
} In the new / edit screen for an “item” I’d like to be able to
} on pressing an add button below the “sub-items” a bit of a form shows
} with the html looking something like:
I recommend against using AJAX for this sort of thing. Yes, you want
removing items, the user is likely to be more comfortable not having the
changes committed until s/he hits the Update (or Submit, or whatever)
button. If you use AJAX you are effectively committing every add and
} The problem: making unique ids for these form elements, generate a
} number and hope for no collisions? store it somewhere? (this led me to
} kinds of questions about sessions)
Use positive numbers for existing ids (probably already the case) and
negative numbers for newly created, and thus not yet committed, ids. I’m
assuming these subitems are a has_many relationship (though it would
just as well with habtm). In your controller, remove any missing
ids and create subitems for any negative ids.
} Also: right now I’ve just got a action ‘hide’ that renders nothing
} use to delete the form element… is there a better practice?
} Basically I’m wondering how they did the lists in Backpack
I have no idea. I’m talking about the right way to interact with a user.