I started writing little modules not long ago. Now I have a case in which I need to reference a content type to a custom entity. However, those entities are a really big table wit 72000+ entities, so if I put a simple select list the add node page will not load beacuse, I suppose, it tries to query too many entities to put in the select list. In my case an autocomplete field is not suitable for various reasons, so I've implemented an ajax dependent dropdown that populates the select field with fewer values, filtered by the value of another field (I followed the examples module "dependant dropdown" and used a module implementing hook_form_alter). To make this work anyway I still had to set a views filter with a limited count of values as the default values (otherwise the page would crash as before). Now the problem is that after I populate the reference select box through the dependent dropdown, I can choose any entity I want, but then the form won't validate as the entity reference field won't accept the new ajax inserted values as they weren't in the views filter.
What should I do next to let the reference field accept the new values, or maybe... any value? (as long as it's one of those custom entities of course).

Comments

kaizerking’s picture

looking for the same

kaizerking’s picture

@Flenix, instead of auto complete use 'select list' and install chosen module and use,
You can configure in the config page of chosen how many values you want to show in drop down list.
It will work for you it will also work for multiple values like auto complete deluxe :)

Also please let me know if you have succeeded in dependent drop down thing. I am very badly in need of that :)

digitgopher’s picture

Issue summary: View changes

I have the same problem. Is there any way to pass the ajax value from the first dropdown to the validator?

caldenjacobs’s picture

I recommend DDF.module (https://www.drupal.org/project/ddf) :)

Richard15’s picture

Ddf is a nice module but I wasn't able to make it work. Could you help me please?

caldenjacobs’s picture

Documentation for DDF module is located at https://www.drupal.org/node/2532790. If you have a support request regarding DDF, go ahead and post it in the issue queue! :)

shahidaali’s picture

DDF module solved the problem.