When the entityreference field is required, the add form is displayed bypassing the ability to add existing nodes. Is it possible to validate whether or not a reference has been made when the field is required rather than forcing the user to add new content?
Comments
Comment #1
tmsimont commentedThis seems to originate around line 382 of inline_entity_form.module:
I'm marking this as a bug report because there's no explanation of this in the UI. If you select "Allow users to add existing nodes." and "Required" on the field instance settings, there is no reason to expect that the "Required" setting would break the "Allow users to add existing nodes." setting.
Comment #2
bojanz commentedAgreed.
The "single" widget should be separate, not activated by a bunch of different factors.
Comment #3
bojanz commentedDone.
http://drupalcode.org/project/inline_entity_form.git/commitdiff/99ca20df...
Comment #4
tmsimont commentedDoes the "Single" widget ever display the option to "select from existing"?
Comment #5
bojanz commentedNope. No buttons, just the inline add / edit form.
I'll document that in the README.
Comment #7
tmsimont commentedwhat if you wanted to select a single entity from a list existing entities? (this is what I'm trying to do)
Comment #8
bojanz commentedYou can just use an ordinary entityreference widget for that (you don't IEF then).
Comment #9
tmsimont commentedI'm using the IEF as a replacement for the ordinary reference widget because I want to provide an option for the user to add a reference inline.
Sometimes a user might want to add a reference that hasn't been created yet. If you're using the ordinary entityreference widget you have to leave the page to create a new reference. This is why I'm using IEF in the first place.
Does that make sense?
Comment #10
bojanz commentedOkay, in that case select "Inline entity form - Multiple values" as the widget, select "Allow existing $entities to be referenced" (where $entities is the name of your entity type), and set the "Allowed values" setting of the field to 1.
This will allow only 1 entity to be either created or referenced.
Please don't reopen the issue, I see your replies even if you don't change the status.