0

Need advice on fufilling this use case:

Use Case:

When User edits the node the first time, he populates Field A, a text area. The data from Field A is eventually displayed on View A.

When User or other User returns to edit the same node, Field A is cleared for convenience, ready for new text input. (But the original data is still in the DB, and displayed in View A).

When the User saves the page this second time, the new data replaces the previous data in View A.

Plus: Eventually, I also need to display the history of Field A in the application from all the saved edits.

1 Answer 1

1

Use hook_form_FORM_ID_alter() with FORM_ID = node_form.

Example:

function your_module_name_form_node_form_alter(&$form, $form_state) {
  $form['field_a']['#default_value'] = '';
}

For the second portion of your question, look into Node revisions.

2
  • Can you provide some guidance on how to implement this code? Jun 18, 2015 at 12:55
  • Are you familiar with writing modules for Drupal? I assumed that was your plan. You would either need to find a module that already does what you want, or write your own and include this code. If you have no experience with writing modules, you can take a look at this guide.
    – Lisa Ugray
    Jun 19, 2015 at 15:13

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.