Is there any way to make a rule that redirects to a given node (in this case a form) and on that form, pre-fill in one of the fields?

I know there is an add content action, but I need to fill in much more data than that action provides.

In my case, I've put a trigger on the add user form, which on-save I want it to redirect to a custom content type add page (stormperson) in this case, which will allow the user to fill in the rest of the CRM-type fields needed for the storm module. Note, these aren't defined as as user profile fields, but it's a custom content pe that happens to a reference to a username, so it would be nice if that user name box could be pre-filled with the user that was just created.

This is a very specific case, but I think it generalizes as well. The basic idea is you fill out one form, and then are redirected to another form that has some values (from the previous form) already filled out for. You fill in the rest and hit save.

Comments

mitchell’s picture

Status: Active » Fixed

The 'add content' is not the action you need, you need 'set default value' which is part of forms support. You will be able to pull values from the newly created node and prepopulate the next form with those values.

Status: Fixed » Closed (fixed)

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

FiNeX’s picture

And if I redirect to admin/user/user/create, is it possible to set the "role" automatically?

Please note that the user which is redirected doesn't have the permissions to set the role but only to create accounts.

El Bandito’s picture

Opensanta

Could you elaborate on this ? I'm currently implementing a solution which uses URL parameters entered on a Rules Page Redirect, and the Prepopulate module to pre-fill form fields. If I could do this with Rules alone it would be great.

Cheers

El B

El Bandito’s picture

I'll elaborate my use case with an example. I have 2 content types : a Project and a Task. A Task has a node reference field which links it to the Project to which it belongs. There is always at least one task per Project.

When a new Project is created ( submitted ) I want to automatically launch the node/add/task form AND pre-populate it's node reference field to the just created Project.

So far I have created a rule that fires on "After saving new content", has a condition to check the content type is Project, and then uses a Page Redirect action to go to node/add/task. However this leaves me without any way I can find of automatically populating the task's node reference field with with the nid of the just created project.

Any pointers appreciated.

Cheers

mitchell’s picture

Status: Closed (fixed) » Active

Here's another method that I've used before instead of rules's form support: use Node Reference URL Widget's autofill capability (basically half of what it was designed for). Add a final parameter on your redirect to the project's nid: /node/add/task/[referenced:nid] (something like that).

There are some other ways if that's not exactly how you want your workflow to go, but this is probably very close to what you're looking for.

mitchell’s picture

Another method is Working with Default Values using %server[HTTP_REFERER].

mitchell’s picture

TR’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

Drupal 6 end of life was 24 Feb 2016. Drupal 6 and Rules 6.x-1.x are no longer supported as of that date, and no bugs with those versions will be investigated or fixed.

Rules Form Support is a separate module in Drupal 7. If this issue is still a problem in the Drupal 7 or Drupal 8 version of Rules Form Support, please open a new issue in that module's queue, with complete details of how to reproduce the bug.