I’m looking to create relationships with Safecracker, and I believe I understand how that works, but I also need to do it in a very special way. The relation looks like this:
One entry from the submitted_labels channel is related to one entry from the labels channel. One entry from the labels channel can be related to any number of submitted_labels.
I would like to have a form where the user enters their address, and then proceeds to create a number of entries in the submitted_labels channel. Like so:
<input name='submitted_labels[name]' />
<!-- of course, there will be more markup here, but we don't need it for the purposes of this discussion. -->Can I have a single Safecracker form create several entries in the submitted_labels channel, or is this just asking too much?
No, not out of the box. You’re talking about one form submitting multiple entries to separate channels.
However EE is very extensible. An extension can hook into the submit entry hooks, and if the submitted_labels need to be unique etc. you could use ajax to check the form data, prior to submit. Does that answer your question?
No, not out of the box. You’re talking about one form submitting multiple entries to separate channels.
Not quite: I want to submit multiple entries to one channel, though a single form post. I apologize if I wasn’t clear… and looking at the post above, it seems that I wasn’t.
But, assuming the above is possible, I might as well ask for a few niceties from EE as well… like allowing those submitted entries to be related to entries from another channel.
Is all of this, or at least the first part, possible? If not, I’ll just write a module to do it - but, if EE/Safecracker was able to do it out of the box, then there’s no reason for me to duplicate the functionality.
Ah, did you mean with “proceed” a second form for the labels? e.g. after first address entry, enter labels via a second form. Still, i don’t think safecracker supports submitting multiple entries at once (even for a single channel).
To relate the second form to the first, you could use the return= parameter to redirect to the second form and pass ENTRY_ID or URL_TITLE for relating. (make sure to include some safeguards against url fabrication etc. Like author_only, require_entry and rules=… and maybe some session-storage etc.)
Still, i don’t think safecracker supports submitting multiple entries at once (even for a single channel).
Yeah, everything I’ve read says this is outside the scope of what Safecracker is typically used for. I think I’ll need to write a module.
Thanks for your help. It seems a standard, documented way to do this just isn’t available.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.