On form submission, I'm getting an error "[dependent field name]: this item can't be referenced".
I've verified that the selection is listed under "Content types that can be referenced", and I'm at a bit of a loss as to where else to look. The functioning triggering the error seems to be dependent_fields_nodereference_element_validate - line 164 of nodereference.inc
Both fields involved are node reference fields.
Any suggestions as to what might be going wrong?
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | select list.png | 4.03 KB | maxime.deg |
| #16 | view projectlist.png | 17.56 KB | maxime.deg |
| #16 | dependend field first part.png | 21.31 KB | maxime.deg |
| #16 | dependend field second part.png | 25.15 KB | maxime.deg |
| #16 | errors.png | 2.29 KB | maxime.deg |
Comments
Comment #1
smoothify commentedThanks again for the report.
I've committed a fix here: http://drupal.org/cvs?commit=461916
This should be in the next automatic dev release, which may not be for a few hours.
Comment #2
Andy Langton commentedExcellent, thanks - I applied the change manually and working fine now.
Comment #3
smoothify commentedGreat :)
Closing this now as the change should be in the current dev release.
Comment #4
gateway69 commentedIm seeing this as well today..
I have 3 cck fields
1 content type select list with various items to select
assets then gets populated as a node ref with a view that filters and passes an argument to provide the right list of assets from the type.
attributes that get displayed based upon the type as well
So if I select
foo as asset type
Assets auto populates to list of foo's filtered by views
attributes auto populates by list of foo's filtered by another view.
when I hit submit my error shows up, which is included in the screen shot..
I also have the fix you have in my build..
Not sure how to fix this, but willing to help debug some how..
Comment #5
gateway69 commentedsorry forgot to attach the image
Comment #6
gateway69 commentedOk i spent some time to track down why this is happening..
if you create a view, a default view, and have an argument in it and select from the Action to take if argument is not present: Hide view / Page not found (404)
which with a default argument of nothing doesn't show anything, this is great because AHAH Dependent Fields dont show up until one of the previous one is selected.
So when I view the page i have just a Type Pull down shown, when I select type a select list Dependent Fields shows up, allowing me to select from the content based upon the view filter..
if i dont do it this way then all Dependent Fields are repopulated with default view data.. I'm not sure why this causes an error but that seemed to be it
Comment #7
smoothify commented@gateway69
This issue is slightly different from the one in the OP, but here goes....
If you don't need anything special from the views lists apart from the empty list at the start - try using without the views and tick the 'Force Controller Filter' box in the AHAH Dependent Fields fieldset.
If you do need to use views, the default view for the field (e.g. without the controller field set) should return ALL potential references. You could set the argument in the nodereference field settings to 'all' and then set up a wildcard in your view which should give the desired effect. Then in the argument overrides you can specify the [controller_field_key] token which should pass in the nid or an empty value which should trigger the empty list.
Unfortunately this issue is due to the fact I can't easily override nodereference field's validation, and the selected reference needs to be inside the master list of references created by the field and its default settings.
It probably should be explained better in the README until I find a way around it.
Comment #8
gateway69 commented@smoothify
thanks for your reply, we should probably move this to another thread..
I think with my situation if I read above requires a bit of code fixing (if even possible)
I have a list of products, and they are broken into categories
So in my view i have a filter and argument, if nothing is passed to the view all products show up, and not filtered by the argument yet.
My controller field is (product category) which is just a cck text/select list
Filter by controller field is enable, force controller filter is set, and under advanced my views arguments is [controller_title]
all of this works , but by default the view displays everything in the db for products, which well looks like poop on the page, the controller title is the argument passed to the view.. lets say star wars items, then only shows items marked as star wars back to the view, this of course works, its just the default display on the node lists everything.. so going into the views argument and checking hidev views/page 404 , works since it doesnt display the default display of everything, just when i submit the form i get that error above.. im going to tinker a bit, but not sure what my solution is yet
thanks for this module btw!
Comment #9
smoothify commentedFor your situation I suggest the following:
First, edit the view and edit the argument. Set the 'Action to take if argument is not present' to 'Hide view / Page not found (404)'.
On the right it should show the wildcard such as 'all' used for showing all items. Make a note of the wildcard and save the view.
Then in the field settings, under 'global settings', set the argument to 'all' (or whatever the wildcard is). Then above in the AHAH Dependent Fields fieldset you can keep the [controller_title] or [controller_key] value for the argument overrides.
This should, hopefully, give you an empty list to start with - let me know how it goes.
BTW. The force controller filter, and filter by controller field are only of use when you are NOT using a view. When you are using a view they have no effect - Obviously the UI needs some work to make this all clearer - perhaps some AHAH magic in there would improve things.
Comment #10
gateway69 commentedthanks, when im back at work ill test it on our staging server.
Comment #11
gateway69 commentedThis seems to work! :) need to test it on a more complex example.. thanks!
Comment #12
gateway69 commentedok, hmm i updated to 6.20 at the office for our server im seeing this issue again, i checked to make sure the file was patched with your solution but now im getting this error again ..
looking in the logs im seeing this
Illegal offset type in isset or empty in /var/www/staging/sites/all/modules/dependent_fields/includes/form_elements.inc on line 130.
Comment #13
gateway69 commentedthis seems to be happening on a basic scale now..
I have one node reference, that pulls a view list.. then i assign a value to it.
see screen shot http://grab.by/8o4L
the associated with is just a select list pulldown, based upon what they select its passed to the view that then filters the data to display a new select list of the values (title, nid) here is the set up of that
http://grab.by/8o4V .. im pretty sure all this was working but seems to be broken with drupal 6.20 ..
any thoughts.. deff willing to help debug somehow
Comment #14
maxime.deg commentedHey,
I took the last version right now, and I have those errors
project: this item can't be referenced.
project: this post can't be referenced.
First, I have a select list that I populated by myself.
On change of this select list, a node reference with the selected item in argument is shown and well populated.
Here everything is really great, but when I click on "Save", those two errors appears ...
Someone could help me :-( ?
Thanks
Comment #15
gateway69 commentedSoulfly, prob need a bit more details, how are you building your select list etc.. screen shots of your stuff also can help.. i use the free service tinygrab
Comment #16
maxime.deg commentedOk, here are some more details.
-ONE text field as a select list (populated by myself). first image (select list.png)
-ONE Reference node as a select list (details on dependent field first and second part.png)
-ONE View 'projectlist' (details in image view projectlist.png)
And the errors are in errors.png
So the module works great, when I select a country in my list the dependend field is well populated !
The problem is when I click on save :'(
I hope, someone can help me with this.
Thanks in advance
Comment #17
maxime.deg commentedOk in fact it seems to be like your post #6
I'll try to understand how you fix it.
Comment #18
pcambraDoing some cleanup as there's a new version for D8/9 and D6 is no longer alive