2

I am trying to show a block (or the term description) on the node edit form when a user selects the term.

An example:

User is creating a node with a "location" vocabulary. They select their state (parent term), then a region in the state. A block or the term description will display directly below the dropdown for the parent term (their chosen state). If they select another state, another block or term description will come up for that state.

Basically each term in the vocabulary will have subtle but different submissions guidelines and I would like to inform the user during the node creation process as to the guidelines for each state.

I am not sure if I should create a "state submission guidelines" content type then Entity Reference it, build a view and embed it or try to get the term description or another field attached to the term to show. How does one make dynamic node edit forms?

I am running Drupal 7, Display Suite, Views, CSHS, Rules as the main stack.

EDIT: I am also using Conditional Fields if that can be utilized.

Thanks.

  • depending on the needs (deleting locations for example) you could do something simple and use a jquery onChange function for the select, with a pop-up or something containing the information. You could have it write to the document, but that wouldn't work if you wanted to allow the user to delete a location during node creation – Geoff Apr 24 '15 at 1:52
2

You can add an #ajax property to the state field in a hook_form_alter() and then include the taxonomy term description as a form item below the state field if state is set. See the ajax examples in the examples module or post here is you have any problems.

I don't think there is any need to use a block.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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