2

My content type has a field call tracking code, I have granted permission for users are able to create content. When they create content, they cannot see tracking code field but after they submit the content, they will see a tracking code string in message area.

In that node I also have reference field with other content type, so the string that I expect to show must include the id of reference node and id of the node being created.

EX: P1C2 (1 is id of reference node, 2 is id of node being created)

Does drupal have any modules support to do that or I must do it programmatically and how can I build the coding for that? Thank you all!

1 Answer 1

3

You could use the computed field module.

Computed Field is a very powerful field module that lets you add a custom "computed fields" to your content types. These computed fields are populated with values that you define via PHP code. You may draw on anything available to Drupal, including other fields, the current user, database tables, you name it. (Feeling the power yet? :) ) You can also choose whether to store your computed field values in the database with other content fields, or have them "calculated" on the fly during node views. (Although you should note that Views use requires database stored values.) This field is literally the Swiss Army knife of fields. So start cooking up your PHP based values!

You can get all the information that you add in other fields with in the computed field. Since you have not yet saved the node you might want to add the following code at the beginning to make the nid available.

https://drupal.org/node/149225

4
  • In that node I also have reference field with other content type, so the string that I expect to show must include the id of reference node and id of the node being created. Is it possible to do that?
    – Ngo Ho
    Commented Oct 9, 2013 at 8:31
  • Yes you can get these data. you can check out this link for additional information. drupal.org/node/149225 Commented Oct 9, 2013 at 8:35
  • Does that field can be hidden when user input the data and it will show the result after they submit node?
    – Ngo Ho
    Commented Oct 9, 2013 at 8:37
  • Yes this field will not be shown to the users. Commented Oct 9, 2013 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.