Needs review
Project:
Node reference field
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
12 Jun 2009 at 18:44 UTC
Updated:
2 Jan 2014 at 19:06 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
boombatower commentedComment #2
dboulet commentedI'm seeing this, as well as extra validation errors because my date fields are required. I guess what we would need to do is to skip validation if all fields are blank?
Comment #3
very_random_man commentedI've fixed this.
I've used the form_alter hook to swap auto-create sub-field validation with a wrapper. The wrapper examines the nodereference field to decide whether or not to run the original field validation.
I've attached a patch. As with the other issue for this module I stuck a patch on, be aware that i've never made a patch before and it may not work! Let me know if that's the case and what I need to do to make it work.
Cheers!
Comment #4
boombatower commentedShould the validation stuff be inside of nodereference_field_element_alter() instead of looping through everything again?
Comment #5
very_random_man commentedGood point. I'd originally written these customisations in a separate module as I wasn't sure i'd have time to come up with a generic solution and just copied it across to the equivalent place. I'll play with it some more and tighten it up when i get a moment today.
Comment #6
very_random_man commentedOk. Bit later than expected but I've got a splendid patch now.
As suggested above, I've integrated the validation code properly.
I've also fixed this other issue:
#631864: Certain widget types don't display on multiple value autocreate fields
Also, I've made it so you can use node references and multiple value fields. This required a bit of restructuring of how the fields are stored in the node so instead of being:
..etc
its now
It probably ought to have some sort of checking in place to check for infinite reference loops but that shouldn't be too hard to add if required.
I've not had time to reword the content_field blurb so it still says you can't have multi fields or nodereferences.
Enjoy!
Comment #7
very_random_man commentedwhoops. forgot to add the patch!
Comment #8
very_random_man commented.... and it appears i forgot to change status too! ;-)