Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
2.2k views
in Q2A Core by
I used Noah's trick to put the answer form at the bottom :

http://www.question2answer.org/qa/11255/how-do-i-move-the-answer-form-below-the-current-answers

 

But when the user doesn't know this and clicks on 'answer', the form disappears. I think it'd be smarter if 'answer' redirects to the form through <a name=''> and <a href=''> procedures.

 

Is it possible to do this without hard-coding
Q2A version: 1.6.1

3 Answers

+1 vote
by

I managed to get this done by hard-coding, but someone with a plugin or something like that - this would be much appreciated.

 

The hard-coding was as follows : 

 

In qa-page-question-view.php I used this code : 

 

 

if ($question['answerbutton']) // don't show if shown by default
$buttons['answer']=array(
'tags' => 'name="q_doanswer" id="q_doanswer" href="#a_form" type="button" onclick="var e=\'anew\' ? document.getElementById(\'anew\') : null;var t=$(e).offset().top;var h=$(e).height()+16;var wt=$(window).scrollTop();var wh=$(window).height();if ( (t<wt) || (t>(wt+wh)) ) qa_scroll_page_to(t);else if ((t+h)>(wt+wh)) qa_scroll_page_to(t+h-wh);if (e.qa_focus)e.qa_focus();"',
//onclick="return qa_toggle_element(\'anew\')"',
'label' => qa_lang_html('question/answer_button'),
'popup' => qa_lang_html('question/answer_q_popup'),
);
 
instead of :
 
if ($question['answerbutton']) // don't show if shown by default
$buttons['answer']=array(
'tags' => 'name="q_doanswer" id="q_doanswer" onclick="return qa_toggle_element(\'anew\')"',
'label' => qa_lang_html('question/answer_button'),
'popup' => qa_lang_html('question/answer_q_popup'),
);

 

by
Partly great solution, thank You !

But if I am right it works well only if the setting is:

- Show ALWAYS the answer box.

If it is set to:

- Show only, if there are no posts, it does not work if You already have posts.

It does not jump to the desired position. I think it does not find the anchor where to jump as there is no answer box in the code ?

The same if the setting is:

NEVER show the answerbox.

It does not jump and not toggle.

For the moment I will work with the first setting, but the second one would be more interesting for me...
by
Lets say, the original method does work, the user just cant see it, as the box or the login to post dialog is at the end of the page.

If I understand it right it would be best to have first moving the page into the right position and after that to toggle show/dont show...
by
Yeah there are some bugs, so I disabled it, but I'll work on it again this evening if I have the time!
0 votes
by
by
It's another issue @jatin.soni. The problem described in the question is when a user clicks "answer" the form disappears because it was already there.
+1 vote
by
My hint for that would be hiding answer button if user is connected that all.
...