Welcome Guest [Log In] [Register]
Viewing Single Post From: Add Extra Field to Post
Viral
Member Avatar
i'm stanley nao
[ *  *  *  *  * ]
This will add an extra field when making a new topic in a designated forum. The info will be added to the end of the post.


Code: HTML
 
<script>
//<![CDATA[
/* Extra field on topic display by Viral of
http://www.moregfx.com/index.php
http://www.zetaresources.com
*/
forumnumber=9936;
extrafieldname="Source";
errormsg="Unfortunately, you did not fill out the "+extrafieldname+" field!";
if(location.href.match(forumnumber)){
$(function(){
$("tr:contains('Topic Tags')").before("<tr><td class='c_desc'>"+extrafieldname+":</td><td><input type='text' autocomplete='off' tabindex='2' value='' name='source' size='40' id='source'/></td></tr>");
});
buttons=document.getElementsByTagName('button');
for(i=0;i<buttons.length;i++){
if(buttons[i].name=="post_submit"){
buttons[i].onclick=function(){
a=document.getElementsByTagName('textarea')[0];
source=document.getElementById('source');
if(source.value.length<=0){alert(errormsg);return false;} else {
a.value+="\nSource: [i]"+source.value+"[/i]";
}}}}}
//]]>
</script>


Edit:
forumnumber=number of forum here;
extrafieldname="Name of the xtra field";
errormsg="If the field is not filled out, this will pop up!";

Have fun.
Edited by Viral, Feb 10 2008, 02:02 PM.
Offline Profile Quote Post
Add Extra Field to Post · User Created Codes