Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+4 votes
537 views
in Q2A Core by

Disable Ask the question botton after 1 click?

How i disable Ask the question botton my site users click one click. Because my site users click 3-4 for 1-2 seconds and ask any copy question.

 

Q2A version: 1.7.1
by
It was also reproduced in my environment. It should be reported as a core problem.
by
It is a good idea . Some times the post is submitted twice and create duplicate questions .

1 Answer

+1 vote
by

The direct solution would be to add to your qa-theme.php:

        function head_custom()
        {

            // default call
            qa_html_theme_base::head_custom();

            if($this->template=='ask')
            {
                $this->output('
                <script type="text/javascript">
                    $(document).ready(function(){
                        $(".qa-form-tall-button-ask").click( function() {
                            $(this).prop("disabled", true);
                            console.log("disabled");
                        })
                    });
                </script>
                ');
            }

        } // end head_custom


Important:

This directly disables the button, afterwards there is NO interaction possible anymore. Why do I say that? Because I have some extra code that stops the submitting and tells the user if there are not enough tags specified, then submitting is prevented. However, with the code above, the user cannot submit the form anymore!

...