Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
in Q2A Core by
edited by
Once a user hits the add answer button he gets redirected to the page and to his answer !

There and only there I want to show a field with extra info, may be a suggestion where to go next or social share buttons,

how could this be achieved ?

Any hint ?



I think the js in ../qa-content/qa-question.js, needs to be modified, at least there are two functions which could help on this ?


function qa_submit_answer(questionid, elem)


function qa_answer_click(answerid, questionid, target)


It would be fully sufficient to get a parameter submitted, so that one knows that he is on the refreshed page after answering, from there, one can add a info box through the theme..




OK through the theme there cant be processed anything as the page does not reload, so either one has to add the information through js, or one needs to trigger a page refresh...
Q2A version: 1.6.1

2 Answers

+2 votes
selected by
Best answer

I think you can just call your custom function from within the code block of qa_submit_answer().

Just after:

                qa_conceal(a, 'form');

you add for example:


and outside of the function, you declare this function, guess you can use jquery as it is loaded already:

                function showUserNotification() {

$('<div id="object">').appendTo('body').html(html).css({ 'top': '200px', 'left': '300px', 'z-index': '10' });



To #object you have to add the content you like, e.g. share buttons etc.

Thank You for the explicit answer, I can start from here.

I always thought that a user after having answered something needs more options to go ahead, now one can have that by showing a box under the new answer !
0 votes

It is cool suggestion. I think that several problem exist, but, how is the method to let jQuery modal form intervene? May this method be realized in plugin without core hacking?

  1. When page loaded, you replace javascript of "onclick" of submit button (name=qa-form-tall-button-ask).
  2. When user clicks submit button, jQuery modal form is displayed.
  3. Extra items are displayed into modal form.
  4. When OK button of modal form was clicked, contents of modal form are copied to extra field on page.
  5. When control returned from modal form, original javascript of submit button is executed by eval.

It may be necessary to extract extra items from database by Ajax...?
It cannot such easily come true...? blush

edited by
I found the thread by kai :


And it was as i thought in the qa-question.js but I have no idea of java so i was trying the last two hours to  add something to:

                var e=document.createElement('div');
//                var newElement = document.createElement('div');
//                newElement.innerHTML = "<div>Hello World!</div>";
//                e.appendChild(newElement);​​​​​​​​​​​​​​​​
                var c=e.firstChild;

But it does not work...???

I modified as well



e.innerHTML=lines.slice(3).join("\n OKOK");

that works and in each row of the answer div OKOK is printed out.

So if I can add something  than I can modify the output and show a box like:

Recommend on facebook | googe+ | twitter

But I dont figure out how to attach something...

And the example by Kai may be great but i dont now how to write such a function.
I misunderstood that you hope to display extra fields to another UI after "question".
However, both are very interesting features.
we could need more flexibility in these areas...
Yes. I think so.