2

I want to set up my own Q&A site. I've installed the Answers module. It has satisfied me mostly, but not entirely. I need to place an answer node add form on the question page. I have no idea how to do this. I tried hooks from dru.io/quieston but my hook does not work.

I tried Advanced form block and it is ok: it displays node add form in question page but answers need to have a relationship to their question. When I add an answer on a page /node/add/answer it does not allow me to add an answer without question id.

So to place an answer, the relative path should be like this: /node/add/answer/117 - where 117 is the node id of the related question. And when I create answer using an Advanced form block form, it really adds a new node, but such answer is not displaying in the question page and has an empty body. Because of question id should be defined.

How to display node add form in other node page with entity reference? And to define question id for this form?

0

1 Answer 1

0

The most recent version of the Answers module (= 7.x-4.0-rc2) already comes, out-of-the-box, with a "answer node add form on the question page" (as in your question). So you don't need any other modules, such as Advanced form block (it all happens automagically).

To experience it yourself, try out a demo of it. Here are the steps to do so:

  • Head over to the demo site.
  • Just accept the defaults to create a sandbox demo site (hit the create sandbox button, and wait for the process to complete).
  • Login to the site (using the suggested defaults).
  • Create at least 1 question using either the "Add content" menu link and then selecting "Question", or just enter relative path /node/add/question. And complete the title and body of the question.
  • After you save the question, you'll see the question that's created (in view mode). And below the question, you should see "No answers yet." (since you just completed posting the question). And then there is the "Your Answer" form right below that. That is the form you can use to post an answer to the question.
  • If you then use that (answer) form to post your answer, and also save that, the (first) answer is shown below the question, and below that answer there is now the "Your Answer" form again (to allow for posting an additional answer).
  • Use the Questions tab (or enter relative path /questions, to get a list (a tabular display) of all existing questions so far (there should be at least one if you completed the previous step).

Note: you may also want to enable the Answers Theme (sub-module of Answers, new as of 7.x-4.x). After you do, return to the question you created before, and see how the look-and-feel of both the question and related answer(s) below it changed ... Here is a sample screenprint of it:

enter image description here

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.