After successfully using this module to populate a CCK text field I tried to use it to populate a Node Reference field and was unsuccessful.

I modified the rules_forms_action_set_element function in rules_forms.rules.inc and was then able to set default values for Node Reference and User Reference fields using NIDs and UIDs.

I'd appreciate it if others could test this patch.

Comments

henrijs.seso’s picture

copy that, all good, you are clear for commit! (patch works)

thanks for your input!

klausi’s picture

StatusFileSize
new1.22 KB

Well, I think that solution is too much hardcoding ...
We can look up the default value array key in the #columns property of the form element. That is a much more generic approach, patch attached. Please test and report back any issues.

meecect’s picture

Both patches worked for me.

klausi’s picture

Version: 6.x-1.1 » 6.x-1.x-dev
Status: Needs review » Fixed

Thanks, committed patch from #2.

Status: Fixed » Closed (fixed)

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

benkovics’s picture

Thank you guys! I tried only the second one, but that worked perfectly!

OnlineWD™’s picture

I have tried both patches and don't understand what they can be used for. What I have is an autocomplete node reference field and I want to populate it using tokens but the ajax tries or wants to load it's own values and it gives error message when I try to use a token.

summit’s picture

SUbscribing, greetings, Martijn

josefo@btinternet.com’s picture

Issue tags: +cck field values

I have a content type build with CCK composed of several fields of different types. This content will be modified along a process workflow but I believe that the values are not being saved on the different fields along the process since each time I open the content to edit it, the content values are blank.

How can I confirm whether the values are being saved and if they are how can I make the appear as the default everytime I open that content node.

Thanks in advance.

jarush’s picture

I want to do the same thing in drupal 7...
any patch ?
Thanks.