I'm probably missing something obvious, or maybe the 6.x-2.x-dev version isn't operational yet.

Interested in what you describe in #2 note, dependent drop-down effect with nodereference fields. I've installed and turned on this module, and I have a content type with nodereference fields. What now? I don't see any admin interface for setting the trim options. Thanks!

Comments

cyu’s picture

should be under site configuration at admin/settings/option_trim

toddwoof’s picture

Okay, got it. Is there supposed to be a menu item in the admin >> Site configuration menu? (There isn't.)

I think I'm almost there:

a. I have two nodereference fields in my content type. Call them field A and field B.
b. I have set up the option_trim relationship to make field B dependent on the choice in field A.
c. I have set which options to show in the field B based on the selection in field A.
d. The node/add form looks right: I can select something in field A, and the correct options based on that show in field B.

However when I try to save the node, I get this error (I clipped the path):

* warning: mysql_real_escape_string() expects parameter 1 to be string, array given in ... /database.mysql.inc on line 321.
* You have selected an invalid option.

Am I missing some step? Thanks!

cyu’s picture

Assigned: Unassigned » cyu
Category: support » bug

I'll set up a test and see if I can duplicate. I've only tested the d6 version in the couple instances where I use option trim and none of my tests had 2 nodereference fields.

Do you have anything out of the ordinary going on that would be different than me creating a new content type, adding 2 nodereference fields, and setting up one as dependent of the other? Also, are you doing a hide or show trim and have you selected to preserve selected options?

toddwoof’s picture

I don't think there is anything unusual. I do have a couple other CCK fields, not related to this. I'll try killing those, to test if it's conflicting with some other select box or something. Note: When I see the error message on save, it's highlighting the second nodereference field (Field B).

I have two nodereference fields, each to a different content type. Does that matter?

Field A shows "Job Categories," and field B shows "Job Titles." In the background, each Job Title node is nodereferenced to a Job Category node. Goal: When you post a job, you pick a job category, then you pick the job title within that category.

I'm doing a "show" trim.

cyu’s picture

Title: How to use the admin interface » Validation not working with 2 nodereference fields

There is some buggy code in there, I was able to duplicate your problem. While fixing it, I've found some other code that needs some love. I'll let you know when I've upped the changes to cvs, thanks for the bug report.

cyu’s picture

You can try out the code from http://drupal.org/cvs?commit=171199 or wait for the snapshot to update, but I believe the 2 nodereference fields are working. I will do a more thorough test of other fields as well.

toddwoof’s picture

Looks as if it's working -- thanks! Especially, thanks for the super-fast response. I'll keep testing. This is a neat module.

cyu’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.