Add a form on creation of a new topic

Go down

Tutorial Add a form on creation of a new topic

Post by Ange Tuteur on March 24th 2014, 9:02 am

Add a form on creation of a new topic

This tutorial will allow you to setup a form for your members to fill out on your Forumotion forum. The form will automatically be added to the editor when creating a new topic in a specific forum, just like on the support forum :


This should work for all forum versions, as long as you're using the default editor.

Adding the javascript
Go to Administration Panel ► Modules ► Javascript codes management ► Create a new script.

Title : Automatic form
Placement : In all the pages
Paste the code below and save :

$(function() {
    if (location.pathname == '/post' && == '?f=FORUM_ID&mode=newtopic') {

Modifying the code :
For this to work, you must first make some changes. You must replace FORUM_ID with the ID of the forum you want this to work in. This ID can be seen from the address bar while in a forum.

You must replace FORM with the fields you want to insert into the editor. You should write your form fields between the single quotes in val().

Special characters to use :

\n : Use this escape sequence to insert a line break.
\" : Use this escape sequence to insert a double quote.
\' : Use this escape sequence to insert a single quote.

When finished you should have an automatic form at topic creation for your members to fill out.

$(function() {
    if (location.pathname == '/post' && == '?f=1&mode=newtopic') {
       $('#text_editor_textarea').val('[b]Field 1[/b]:\n[b]Field 2[/b]: Don\'t fill this field in\n[b]Field 3[/b]:');

Attention :
Line breaks must be written as \n otherwise you risk breaking the script.

The quote escape sequences should be used when writing double quotes inside double quotes and vice versa. Failure to do so will cause the string to close early and break the script.

Ange Tuteur

Male Posts : 13217
Reputation : 2944
Language : EN, JA, FR
Location : Macungie, PA

Back to top Go down

Back to top

Permissions in this forum:
You cannot reply to topics in this forum