The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Add a form on creation of a new topic

View previous topic View next topic Go down

Solved Add a form on creation of a new topic

Post by sunshine_222 on January 14th 2015, 2:39 pm

Add a form on creation of a new topic

Thank you, @Ange Tuteur, for this great script and tutorial! It's really very useful!

But, is it possible to modify the script, so the form of new topic will appear in certain subforums, not in all or in one? I know that it is made to work in one subforum, but I want to use one form (JS) for few forums, not to make few JSs for them. Is it possible?


Last edited by sunshine_222 on January 15th 2015, 3:36 pm; edited 1 time in total

sunshine_222
Forumember

Posts : 91
Reputation : 2
Language : english

http://thaimagic.forum2x2.eu

Back to top Go down

Solved Re: Add a form on creation of a new topic

Post by Ange Tuteur on January 15th 2015, 4:44 am

Hello @sunshine_222,

Yes it's absolutely possible. You can place multiple conditions for the form to work. Try this instead :
Code:
$(function() {
  if (location.pathname == '/post' && location.search.match(/mode=newtopic/)) {
    var f = document.post.f.value;
    if (f==1 || f==2 || f==3 || f==4) {
      $('#text_editor_textarea').val('FORM');
    }
  }
});

Where you see f==1, it's checking if you're making a new topic in forum 1, if not it'll check the next condition. Separate multiple forums by ||

Also, make sure to change the IDs I placed already with the forum IDs you want. Wink

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Add a form on creation of a new topic

Post by sunshine_222 on January 15th 2015, 12:05 pm

I've put the number of forum here "f==1" instead of 1, only the number, but it don't works.

sunshine_222
Forumember

Posts : 91
Reputation : 2
Language : english

http://thaimagic.forum2x2.eu

Back to top Go down

Solved Re: Add a form on creation of a new topic

Post by Ange Tuteur on January 15th 2015, 1:13 pm

Post the code here.

Thanks Wink

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Add a form on creation of a new topic

Post by sunshine_222 on January 15th 2015, 3:01 pm

Here it is:

Code:
$(function() {
      if (location.pathname == '/post' && location.search.match(/mode=newtopic/)) {
        var f = document.post.f.value;
        if (f==f18-forum || f==f1-forum || f==f17-forum {
          $('#text_editor_textarea').val('FORM');
        }
      }
    });

sunshine_222
Forumember

Posts : 91
Reputation : 2
Language : english

http://thaimagic.forum2x2.eu

Back to top Go down

Solved Re: Add a form on creation of a new topic

Post by _Twisted_Mods_ on January 15th 2015, 3:03 pm

just use the # not the f

Code:
$(function() {
      if (location.pathname == '/post' && location.search.match(/mode=newtopic/)) {
        var f = document.post.f.value;
        if (f==18-forum || f==1-forum || f==17-forum {
          $('#text_editor_textarea').val('FORM');
        }
      }
    });

_Twisted_Mods_
Helper
Helper

Male Posts : 2020
Reputation : 299
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Add a form on creation of a new topic

Post by sunshine_222 on January 15th 2015, 3:09 pm

Thank you, _Twisted_Mods_, but this don't work, too.
Something in this and for the smiles scripts block all my previous JSs in modules, including them.

sunshine_222
Forumember

Posts : 91
Reputation : 2
Language : english

http://thaimagic.forum2x2.eu

Back to top Go down

Solved Re: Add a form on creation of a new topic

Post by _Twisted_Mods_ on January 15th 2015, 3:22 pm

lol u added the number # sign i mean just use the number after the f .. i posted the code above just copy and paste it

_Twisted_Mods_
Helper
Helper

Male Posts : 2020
Reputation : 299
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Add a form on creation of a new topic

Post by sunshine_222 on January 15th 2015, 3:27 pm

The same situation.

sunshine_222
Forumember

Posts : 91
Reputation : 2
Language : english

http://thaimagic.forum2x2.eu

Back to top Go down

Solved Re: Add a form on creation of a new topic

Post by Ange Tuteur on January 15th 2015, 3:30 pm

Try now :
Code:
$(function() {
  if (location.pathname == '/post' && location.search.match(/mode=newtopic/)) {
    var f = document.post.f.value;
    if (f==18 || f==1 || f==17) {
      $('#text_editor_textarea').val('FORM');
    }
  }
});

You cut of the closing of the condition by mistake. Also, you only need to include the forum number, nothing more. Wink

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Add a form on creation of a new topic

Post by _Twisted_Mods_ on January 15th 2015, 3:31 pm

here try this you was missing ) at end of "if" command and ; at end of the form
Code:

$(function(){
   if(location.pathname=='/post'&&location.search.match(/mode=newtopic/)){
   var f=document.post.f.value;
      if(f==18-forum||f==1-forum||f==17-forum){
 $('#text_editor_textarea').val('\n[center][size=24][color=#000000][b]Име\ Фамилия[/b][/color][/size][/center]\n\n[center][color=#0000ff]снимка[/color][/center]\n\n[center][color=#000000][b]Име:\ [/b][b]име\ фамилия[/b][/color]\n[color=#000000][b]Прякор:\ [/b][/color]\n[color=#000000][b]Занятие:\ [/b]актьор,\ модел,\ водещ,\ бизнесмен[/color]\n[color=#000000][b]Роден\ на:\ [/b][/color]\n[color=#000000][b]Място\ на\ раждане:\ [/b]Банкок,\ Тайланд[/color]\n[color=#000000][b]Ръст:\ [/b][/color]\n[color=#000000][b]Зодия:\ [/b][/color]\n[color=#000000][b]Семеен\ статус:\ [/b][/color]\n[color=#000000][b]Образование:\ [/b][/color]\n[color=#000000][b]Хоби:[/b][/color][/center]\n\n[center][color=#000000][b]СЕРИАЛИ:\ [/b][/color][/center]\n\n[center][color=#000000]заглавие\ на\ тайландски\ (година)\ с\ името\ на\ партньорката\ му[/color][/center]\n\n[center][color=#000000][b]ФИЛМИ:[/b][/color][/center]\n\n[center][color=#000000]име\ (година)[/color][/center]\n\n[center][color=#000000][b]ГАЛЕРИЯ:[/b][/color][/center]\n\n\n[center]:asianfuse wiki\ :eng wiki:\ :thai wiki:\ :1:\ :fb:\ :ig:[/center]\n\n');
      }
}
});

_Twisted_Mods_
Helper
Helper

Male Posts : 2020
Reputation : 299
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Add a form on creation of a new topic

Post by sunshine_222 on January 15th 2015, 3:32 pm

Thank you, Ange Tuteur! Now it works! And all the JSs work, too. Very Happy

Thank you, _Twisted_Mods_!

sunshine_222
Forumember

Posts : 91
Reputation : 2
Language : english

http://thaimagic.forum2x2.eu

Back to top Go down

Solved Re: Add a form on creation of a new topic

Post by Ange Tuteur on January 15th 2015, 4:26 pm

You're welcome ^^

Topic archived

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


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