I tried the autofill and it works nice when the user is using it, but what about to autofill field when the entityreference field is pre-populated over the url with module
https://drupal.org/project/entityreference_prepopulate
This would allow, to prefill fields and user can review the values and save it.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | entityreference_autofill-prepopulate-support-2177709-3.patch | 11.6 KB | jgullstr |
Comments
Comment #1
jgullstr commentedThat's a good idea! I've started to look into this, but the module will need some restructuring to work. Expect a patch in a week or so.
Comment #2
mariusm commented+1
Comment #3
jgullstr commentedPatch provided as promised. Please try it out and let me know if it works as expected.
Note: You need to run update.php for the module to recognize prepopulate data.
Comment #4
mariusm commentedit's ok
Thanks
Comment #5
mariusm commentedif you can add a small improvement ->
ability to hide fields like prepopulate
Thanks
Comment #6
jgullstr commentedThe hide field action should still work by setting it from prepopulate settings, or is it not working for you?
Comment #7
mariusm commentedIn my implementation only hides the reference field.
I want to hide fields prepopulated with your module.
Thanks
Comment #8
jgullstr commentedAh ok, sorry I missed your point. Hiding the fields populated by this module, I believe, falls outside the module's scope. I will consider options for making autofill data available for other modules in a later release, but unfortunately there is no simple way of doing this in the current version.
//Josef
Comment #9
jgullstr commentedComment #10
jgullstr commentedCommited changes.
Comment #11
jgullstr commentedmariusm,
The latest dev version has its own $form_state array. If you need to hide the autofilled fields, it can be accomplished by implementing a form_alter in your custom module. Something along the lines of this should do it:
Hope this helps.
//Josef
Comment #13
rollingnet commentedsee below
Comment #14
rollingnet commentedI'm using the latest dev either of this module and prepopulate one.
When I prepopulate a form with entity reference field and then use autofill function, everything is ok, except if I make en error in the form (like leaving blank a mandatory field).
In this case, the entity reference field (that is prepopulated) becomes blank.
This not happen if I don't use the autofill function in the form, the page simple reload showing me the error and entity reference value is still here.
So I think this bad behavior is caused by this module and not by the prepopulate one.
Comment #15
jgullstr commentedThat sounds odd. Can you provide a database dump demonstrating this behavior using only prepopulate and autofill?
//Josef
Comment #16
rollingnet commentedI can provide the live site where this behavior occurs:
http://www.unannoconnoi.it/node/add/modulo-iscrizione?field_evento_a_cui...
as you can see,the prepopulated one is the first one, i.e. "Evento a cui si vuole partecipare" and the autofill field is the second one, i.e. "Ricerca partita IVA".
I use the autocomplete limit length module (https://drupal.org/project/autocomplete_limit) to start autocomplete function only after 11 digits are inserted.
Try to digit this 02527661207 in the "Ricerca partita IVA" field.
You'll see that some fields t will be correctly autocompleted.
Now submit ("invia") the form without filling any other fields.
Look at the prepopulated field (the first one): it is blank now.
If you try to submit the form without autocompleting it, the first field is correctly prepopulated.
Comment #17
jgullstr commentedDoes the problem disappear if you disable the autofill functionality on "Ricerca partita IVA"?
Comment #18
rollingnet commentedI can confirm that disabling the autofill functionality, the form works correctly, so the issue is in this module.
Comment #19
rollingnet commentedI think that this issue can be related to incompatibility of this module with validation from field validation module: in the form there are fields that are validated with this option checked:
Comment #20
jgullstr commentedCan you export the content type and its dependencies as a feature (preferably), alternatively provide a clean database dump or a step-by-step guide? I haven't been able to replicate this error (although I can see it exists from your link).
//Josef
Comment #21
rollingnet commentedI've just installed the latest dev version of Entity Reference Prepopulate and the issue above seems to be solved. So it seems it was an issue related to that modules and not to this one.
Comment #22
jgullstr commentedOk, great! Setting status back to fixed.
//Josef