Questionnaires script v2
Allows you to create questionnaires with different types of fields for filling by the user. There are many options for settings.

https://forumstatic.ru/files/0019/a4/e9/57006.jpg

https://forumstatic.ru/files/0019/a4/e9/62981.jpg

https://forumstatic.ru/files/0019/a4/e9/67568.jpg

Mode author: satsana
Script author: Alex_63
The script was created by order of the ForumD.ru team!
Платформа: MyBB
Демо: MAKE ORDER (questionnaire template)
/БЕСПЛАТНО/ Дизайн mybb Романовы. Сюжеты русской истории. (the final questionnaire)

Description:
1. Allows you to create the necessary types of fields for text input: input and textarea, select and checkbox with pre-defined items to choose from.
2. Allows you to automatically specify the name of the questionnaire associated with the name of the nickname, or with the name of the new character being entered by the user, or the permanent name for all questionnaires, or with the name completely filled in the questionnaire. In addition to the header, you can insert word combinations-options to select the user.
3. Allows you to create questionnaires either as a separate topic or as attachable posts to the questionnaire template. You can create an unlimited number of independent templates for questionnaires in pre-registered forums!
4. Allows you to mark the obligatoryness of some (or all) fields for filling.
5. Allows the user to insert in the textarea field BB tags
6. Allows you to split a long questionnaire into several parts that are successively opened by filling in the required fields.

7.new "Composite" title of the topic - now it is possible to add keywords to the headings on the options marked by users.
8.new Fixed an issue with inserting code tags into textarea forms. Earlier applications with such codes simply were not sent. Now it is possible.
9.new Added more buttons in the textarea form: code, hidden text, spoilers, highlighting, and other text formatting tools.
10.new Textarea fields can now be in simple text mode (the usual multiline field filled by the user), hidden text (automatically wraps the content into the tags hide=99999, so that only admins and moderators can read it) and code (automatically wraps the content in the code tags)

codes for installing the script

HTML верх (Admin > Options: 1st window)

<!-- Script for creating questionnaires © ForumD.ru -->
<script type="text/javascript">
var Questnr = {};
Questnr.groups = [1,2,12,6]; //Groups that are allowed to create templates for profiles
Questnr.forums = [5,80,6,19,96,2,97,44,22,108]; //Forums with admission to the questionnaire
Questnr.title  = 'Questionnairy form '; //Beginning of the topic header with the questionnaire (default)
Questnr.noedit = 1; //Prohibition to edit the completed questionnaire by the user
</script><script type="text/javascript">
['viewforum','viewtopic','post','edit'].indexOf($('.punbb')[0].id.substr(4))!=-1&&
$().pun_mainReady(function(){var s='script',l='https://forumstatic.ru/files/0019/a4/e9/28248.js';
var f=$('#pun-viewforum').length?$('link[rel="alternate"]'):$('.crumbs a[href*="viewforum"]:last');
f=+f[0].href.match(/id=(\d+)$/)[1];Questnr.forums.indexOf(f)!=-1&&document.write('<'+s+' src="'+l+'"></'+s+'>')});
</script>
<script>
Questnr.allowReply = [+$('link[rel="alternate"]')[0].href.match(/id=(\d+)$/)[1]]; //текущая тема
</script>


Addition: Buttons of BB-tags above multi-line fields in the questionnaire
HTML низ: (Admin > Options: 2nd window)

Code:
<!-- Questionnaire: Adding BB tags to textarea -->
<style>
 .new[id=form-buttons]{max-width:104px}.new[id=form-buttons] table{margin:0}
 .new[id=form-buttons] td{border:0 none transparent!important; height:24px;padding:0!important}
</style>
<script type="text/javascript">
 if(GroupID != 3)$(function() {var button_tbl = $('#post #form-buttons').clone().addClass('new');
  button_tbl.find('#button-image>img')[0].setAttribute('onclick','bbcode(\'['+'img]\',\'[/img]\')');
  button_tbl.find('td:not(#button-bold):not(#button-italic):not(#button-underline):not(#button-image):not(#button-strike):not(#button-left):not(#button-center):not(#button-right):not(#button-link):not(#button-spoiler):not(#button-hide):not(#button-code):not(#button-color)').remove();
  button_tbl.insertBefore('.questionary-post textarea');
    $('.new[id="form-buttons"]').on('mouseenter',function() {
    var area = $(this).next('textarea');if(!area.length){area = $(this).next().find('textarea');}
    $('.questionary-post').find('textarea').removeAttr('id');
    if(area[0].id!='main-reply')area.attr('id','main-reply');
     }).on('mouseleave',function(){$('.questionary-post textarea').removeAttr('id');});
  });
</script>

Addition: We allow sending responses in some topics in the questionnaires
HTML верх (Admin > Options: 1st window) below the main part of the questionnaire script:

<script>
Questnr.allowReply = [ 17,28 ];// ID of topics in questionnairy-forums, where they are allowed to respond to users
</script>

If you need to return a response form in all topics in questionnairy-forums, the code will look like this:

Code:
<script>
Questnr.allowReply = [+$('link[rel="alternate"]')[0].href.match(/id=(\d+)$/)[1]]; //текущая тема
</script>
CREATION OF QUESTIONNAIRY TEMPLATES, EXPLANATIONS

To create a questionnaire template in a certain forum, at least one topic must be created.


https://forumstatic.ru/files/0019/a4/e9/16608.jpg


The work starts on the left side of the control panel of the template creation form (controls 1-3)
controls:
1. Radio buttons to switch the option of creating questionnaires (create a new topic / add a post to the current one)
2. Menu for selecting an option for creating a questionnaire title
3. Button insertion control tag, defined by your choice of controls 1 & 2 (Where to create a questionnaire and title format)
PS: Putting your own version of the topic title in the questionnaire template:
[input topic-name=Questionnairy form ...]
In the first tag, the template defaults to the default theme name, replace in the next template with the desired one


13. If you chose to "create a new topic", then after you select the main type of topic title with the sent templates, you can make options-additions to the it:
ATTENTION! Remember that the title of the topic is limited! Options with keywords should be short.
Example of choosing the options for the questionnaire title: MAKE ORDER
Options can be put in any place, wrap around them explanations (see item 10). Regardless of the place in the questionnaire - they will work on the title when the user chooses.


11. Fill in the name of the topic with the questionnaire template


12. The submit form that creates the questionnaire template


Insert tags:  input и textarea, select и checkbox
4. We select the desired item in the drop-down menu №4
5. We enter the explanatory text displayed inside the selected element, input at number 5
6. We prescribe the sizes of the selected element, the field at number 6. The sizes are prescribed by a number, the pixels are meant!
(You can also specify the width in percent.)
7. The checkbox to select the required filling of the inserted item by the user (if the required element is not filled - the questionnaire is not sent)
8. Button to insert the selected item into the template creation form


When the textarea field is selected, there are additional options for displaying the content filled by the user:
https://forumstatic.ru/files/0019/a4/e9/83563.jpg
• Simple text - a simple textarea field
• Hidden text - automatically wraps content in tags hide=99999 (only admins and moderators can read it)
• Code - automatically wraps the content in the code tags


9. Separator of the questionnaire into parts.
If we apply the separation tag [part], then it must be inserted before each part of the questionnaire, including the first one!


10. The insert of the framing tags of the explanation (the explanations are not included in the sent questionnaire filled in by the user)


P.S.: All tags input и textarea, select & checkbox you can wrap in any tags, except textarea