Problems getting a javascript working on forum
5 posters
Page 1 of 1
Problems getting a javascript working on forum
I was trying to set it up so I could have automatic polls for a few of the product review categories in my forum using the 2nd javascript from this topic https://help.forumotion.com/t143063-how-can-i-add-an-automatic-poll-like-here-on-the-support-forum
However despite making sure the forum id's are correct and javascript code management is enabled in the control panel when a new post is posted in said forums/categories it does not automatically create the poll
I am using awesomebb for the forum
what I'm trying to use:
However despite making sure the forum id's are correct and javascript code management is enabled in the control panel when a new post is posted in said forums/categories it does not automatically create the poll
I am using awesomebb for the forum
what I'm trying to use:
- Code:
window.location.pathname == '/post' && $(function () {
var forums = [24, 25],
lang = {
info : 'The poll will be added automatically.',
poll_question : 'Arvosana',
poll_answers : '1\n2\n3\n4\n5'
},
i = 0,
j = forums.length,
f;
if (document.post && document.post.mode.value == 'newtopic') {
f = document.post.f.value;
for (; i < j; i++) {
if (f == forums[i]) {
$(document.post.poll_title).closest('fieldset').html('<strong>' + lang.info + '</strong><input type="hidden" name="poll_title" value="' + lang.poll_question + '" /><input type="hidden" name="poll_option_text" value="' + lang.poll_answers + '"><input type="hidden" name="poll_length" value="0" /><input type="hidden" name="poll_cancel_vote" value="1" />');
break;
}
}
}
});
Last edited by VDimensional on January 9th 2025, 2:13 pm; edited 1 time in total
VDimensional- New Member
- Posts : 11
Reputation : 1
Language : Finnish
Re: Problems getting a javascript working on forum
hello
this script is created for version PHPBB3
each version has different elements so this is way this script is not working on your forum
this script is created for version PHPBB3
each version has different elements so this is way this script is not working on your forum
Re: Problems getting a javascript working on forum
skouliki wrote:hello
this script is created for version PHPBB3
each version has different elements so this is way this script is not working on your forum
Good to know. How would I modify the script to work with AwesomeBB? I'm not too familiar with this script stuff
VDimensional- New Member
- Posts : 11
Reputation : 1
Language : Finnish
Re: Problems getting a javascript working on forum
Sadly the maker of the script is no longer using the forum so unless @Razor12345 or @Niko can try and make this work for you then I'm sorry we can't help you.
Sadly that code is a little old now and was not made to work for other forums.
Sadly that code is a little old now and was not made to work for other forums.
Niko likes this post
Re: Problems getting a javascript working on forum
Ape wrote:Sadly the maker of the script is no longer using the forum so unless @Razor12345 or @Niko can try and make this work for you then I'm sorry we can't help you.
Sadly that code is a little old now and was not made to work for other forums.
I see. Would there be any other methods to implement such product review functionality? A star based rating system would be ideal for such application but I've had little luck in finding a solution. I understand though if such a feature is not possible to easily implement
VDimensional- New Member
- Posts : 11
Reputation : 1
Language : Finnish
Re: Problems getting a javascript working on forum
@VDimensional no idea if there could be another way, it's probably something that is worth a suggestion
If instead you want to adapt the code to AwesomeBB version, could you give me your preference for all these settings?
If instead you want to adapt the code to AwesomeBB version, could you give me your preference for all these settings?
- Poll question
- Poll options
- Vote cancelling allowed
- Display the list of members who voted
- Display the list of members who voted for each choice
Re: Problems getting a javascript working on forum
Niko wrote:@VDimensional no idea if there could be another way, it's probably something that is worth a suggestion
If instead you want to adapt the code to AwesomeBB version, could you give me your preference for all these settings?
- Poll question
- Poll options
- Vote cancelling allowed
- Display the list of members who voted
- Display the list of members who voted for each choice
Thank you for being helpful! I'm sure to put down the rating system in the suggestions
Here is the current format we've been using for the reviews:
Poll question: Arvostelu
Poll options: 1, 2, 3, 4, 5
vote cancelling allowed: yes
Display list of members who voted: no
Display the list of members who voted for each choice: no
The polls are ofcourse set to last infinitely so people can rate the same products in the future aswell
VDimensional- New Member
- Posts : 11
Reputation : 1
Language : Finnish
Re: Problems getting a javascript working on forum
Here you are
You can add this javascript content for AwesomeBB
I added a line that opens the tab so that it displays the poll added message (because in AwesomeBB sections are closed by default). If you prefer to keep it closed, just remove this line:
For the other customizations, you can follow the original topic instructions
You can add this javascript content for AwesomeBB
- Code:
window.location.pathname == '/post' && $(function () {
var forums = [1,2],
lang = {
info : 'The poll will be added automatically.',
poll_question : 'Arvostelu',
poll_answers : '1\n2\n3\n4\n5'
},
i = 0,
j = forums.length,
f;
if (document.post && document.post.mode.value == 'newtopic') {
f = document.post.f.value;
for (; i < j; i++) {
if (f == forums[i]) {
$(document.post.poll_title).closest('.block-content').html('<strong>' + lang.info + '</strong><input type="hidden" name="poll_title" value="' + lang.poll_question + '" /><input type="hidden" name="poll_option_text" value="' + lang.poll_answers + '"><input type="hidden" name="poll_length" value="0" /><input type="hidden" name="poll_cancel_vote" value="1" /><input type="hidden" name="poll_public_members" value="0" checked="checked"><input type="hidden" name="poll_public_whovoted" value="0" checked="checked">');
$(function() { $(document.post.poll_title).closest('.block').removeClass('forum-hidden'); });
break;
}
}
}
});
I added a line that opens the tab so that it displays the poll added message (because in AwesomeBB sections are closed by default). If you prefer to keep it closed, just remove this line:
- Code:
$(function() { $(document.post.poll_title).closest('.block').removeClass('forum-hidden'); });
For the other customizations, you can follow the original topic instructions
skouliki, SLGray, Sir Chivas™, TonnyKamper and VDimensional like this post
Re: Problems getting a javascript working on forum
Niko wrote:Here you are
You can add this javascript content for AwesomeBB
- Code:
window.location.pathname == '/post' && $(function () {
var forums = [1,2],
lang = {
info : 'The poll will be added automatically.',
poll_question : 'Arvostelu',
poll_answers : '1\n2\n3\n4\n5'
},
i = 0,
j = forums.length,
f;
if (document.post && document.post.mode.value == 'newtopic') {
f = document.post.f.value;
for (; i < j; i++) {
if (f == forums[i]) {
$(document.post.poll_title).closest('.block-content').html('<strong>' + lang.info + '</strong><input type="hidden" name="poll_title" value="' + lang.poll_question + '" /><input type="hidden" name="poll_option_text" value="' + lang.poll_answers + '"><input type="hidden" name="poll_length" value="0" /><input type="hidden" name="poll_cancel_vote" value="1" /><input type="hidden" name="poll_public_members" value="0" checked="checked"><input type="hidden" name="poll_public_whovoted" value="0" checked="checked">');
$(function() { $(document.post.poll_title).closest('.block').removeClass('forum-hidden'); });
break;
}
}
}
});
I added a line that opens the tab so that it displays the poll added message (because in AwesomeBB sections are closed by default). If you prefer to keep it closed, just remove this line:
- Code:
$(function() { $(document.post.poll_title).closest('.block').removeClass('forum-hidden'); });
For the other customizations, you can follow the original topic instructions
Thank you! This encourages more of my forums members to write product reviews
VDimensional- New Member
- Posts : 11
Reputation : 1
Language : Finnish
Niko likes this post
Re: Problems getting a javascript working on forum
Problem solved & topic archived.
|
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Similar topics
» Javascript not working
» Some JavaScript codes are not working
» Javascript not working..
» Thanks Like Forumotion JavaScript Not working
» 'Copy Code' Javascript not working.
» Some JavaScript codes are not working
» Javascript not working..
» Thanks Like Forumotion JavaScript Not working
» 'Copy Code' Javascript not working.
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum