The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Autofil form for new topic [phpBB3]

2 posters

Go down

Autofil form for new topic [phpBB3] Empty Autofil form for new topic [phpBB3]

Post by Wizzard November 9th 2024, 9:46 am

Let's say you have a forum for movies and you want when user click on the button to open a new topic to give him already made template so that he doesn't have to type over and over. You can do so with the script I will give you. This is how it looks:

Autofil form for new topic [phpBB3] Screen12

To achieve this there are some thing needed to be done. Let's go and :

Go to AP -> Modules -> Javascript management and make a new script. Name it "Autofill form" and for placement choose "In the topics".

Paste this code:
Code:
$(function() {
    if (location.pathname === '/post' && location.search === '?f=11&mode=newtopic') {
        $('#text_editor_textarea').val(
            '[b]IMDB:[/b]\n[b]IMDB score:[/b]\n[b]Trailer:[/b]'
        );
    }
});

Pay close attention here. You can see "?f=11&mode=newtopic" but that's for my forum, your forum number is different. How to know this? Let's say I found my forum I want to use autofill:
Autofil form for new topic [phpBB3] Screen13

I would click on that forum and look in URL to find: ".forumotion.me/f5-skriptni-problemi-kodiranje" and there you go. You have what is the number next to letter f (it's five).
So, you put that number here "??f=11&mode=newtopic'" (instead of 11).

What else? Well, you can change what is being presented when user clicks to open new topic inside:
Code:
val(
            '[b]IMDB:[/b]\n[b]IMDB score:[/b]\n[b]Trailer:[/b]'
        )
I gave you example for movies, you do whatever you want.

Bonus: If you want you can post many scripts inside the same script to cover many other forums with different things like this:
Code:
$(function() {
    if (location.pathname === '/post' && location.search === '?f=11&mode=newtopic') {
        $('#text_editor_textarea').val(
            '[b]IMDB:[/b]\n[b]IMDB score:[/b]\n[b]Trailer:[/b]'
        );
    }
});

$(function() {
    if (location.pathname === '/post' && location.search === '?f=8&mode=newtopic') {
        $('#text_editor_textarea').val(
            '[b]Game name:[/b]\n[b]Game description:[/b]\n[b]Screenshot:[/b]'
        );
    }
});
Wizzard
Wizzard
Forumember

Male Posts : 125
Reputation : 23
Language : English

https://net-cafe.forumotion.com/

SarkZKalie, TonnyKamper and كونان2000 like this post

Back to top Go down

Autofil form for new topic [phpBB3] Empty Re: Autofil form for new topic [phpBB3]

Post by SarkZKalie November 14th 2024, 4:01 pm

Thank you for sharing santa


Autofil form for new topic [phpBB3] Sarkzk10
SarkZKalie
SarkZKalie
Support Moderator
Support Moderator

Male Posts : 1446
Reputation : 220
Language : English

https://rotavn.forumotion.com/

Wizzard likes this post

Back to top Go down

Back to top

- Similar topics

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