Closed (fixed)
Project:
Node Reference URL Widget
Version:
6.x-1.1
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
14 Apr 2009 at 04:04 UTC
Updated:
3 Jan 2014 at 00:07 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
quicksketchI've got this as a TODO already in code, and all the code is already in place as far as I could figure out. I ran into a problem where the value of the autocomplete field wasn't being saved properly. Anyone that has an idea on what could be wrong with the existing code, please take a look.
Just uncomment the line around 127 in nodereference_url.module:
Comment #2
OneTwoTait commentedAny luck on this?
Comment #3
quicksketchNo, I gave it another attempt recently but still have not been able to get it to work properly.
Comment #4
Flying Drupalist commentedSubscribe
Comment #5
hefox commentedDidn't need this, but I like this module and was curious if I could figure it out
The issue is in the validate function of the node reference element it expects it to be formated as a multi value, ie
0=> nid => val
instead node reference is coming back as
nid=> val
Tried to make it so the $element was a pretend multi value etc, but didn't full it, but figured a work around
Add a validation function to nodereference (Un needed info, but due to an unshift in nodereference it's validation function ALWAYS runs first).
Then the grand validation function...
Basically, get it into the format that nodereference field wants to process.
(Actually, I think this is a nodereference issue more than a node reference url, possible. Should handle single output from nodereference single widget, but doesn't. Check the 'validate' inside of field_info of nodereference. )
Comment #6
quicksketchNice hefox! Yeah this would definitely be great to fix in Node Reference if possible. I haven't tried you approach but it looks like a good canidate for the module if we can't fix it in Node Reference.
Comment #7
hefox commentedI'm still not sure if it is a node reference bug or not; in general the expected format of cck field with delta=>value=>? If so, then it's a node reference. But if single instantaneous of a cck field with the value return as value=> is supportable.. then it is a node reference issue.
And oops, the issue is in the implementation of nodereference_field hook when it's validating the output
If I was to fix it, i'd put before the foreach a
Comment #8
mlncn commentedCongratulations, hefox! This helpful effort turns out to be related to a requested feature on a project you are working on! #opensource-awesomeness
Came here to file a feature request; only bumping and subscribing for now.
ben, Agaric
Comment #9
borisbarowski commentedI would love this functionality too, it would be very helpful on a site i'm building.
thanks for working on this!
hence, subscribing
Comment #10
hefox commentedI tried explaining what was causing the node reference issue in cck issue queue (along with another tweek i'd like), but I either didn't manage to make sense (based on the response I got) or didn't make convincing argument to change it in core cck (the issue http://drupal.org/node/530534 ). looks like this is something that needs to be done in nodereference_url even if it's an ugly workaround.
Anther way is to make two widgets, one for multi widget fallback (select, checkboxes) and one for autocomplete fallback. Would be some duplicate code, but would fix the multi issue.
Comment #11
entrigan commentedThanks for looking into this hefox,
Do you have any ideas on how to make a workaround that does not involve modifying node-reference module?
Comment #12
hefox commented^ the workaround is above number #5 (should still work, haven't tested since nodereference_url was updated); the part about that is that it could be solved via both altering node reference or doing the work around; I just dislike the uglyness of the workaround.
Comment #13
malcomio commentedsub
Comment #14
malclocke commentedThanks hefox for taking the time to sort this out. I've rolled your solution from #5 into a patch, tested and works for me.
Comment #15
malcomio commentedexcellent, that works perfectly - thanks very much
Comment #16
quicksketchThanks malclocke for the patch! We just should be using form_set_value() rather than manually assigning the $form_state value in nodereference_url_autocomplete_validate(), since that will break when used with field groups.
Comment #17
malclocke commentedRe-rolled using form_set_value() (I think correctly). Tested and working with nodereference inside and outside a fieldgroup.
Comment #18
go2guys commentedThe patch works! Thanks a bunch!
Comment #19
dandaman commentedOK, I tested it out on my site and it seems to work great. Am I supposed to change it to "RTBC" then or just post that I think it works great and that it's ready?
Comment #20
quicksketchYep, definitely RTBC. I'll give this one last look before committing next time I'm working on the module.
Comment #21
kruser commentedWorks for me, but the other thing needed for this is the Autocomplete matching selection (Starting with or Contains). It's defaulting to Contains.
Comment #22
quicksketchCommitted #17, great work malclocke!
Comment #23
nikodev commentedTHX malclocke!
Very nice patch!