Welcome Guest [Log In] [Register]
This board has been archived and is no longer accepting new questions. If you have a support question for your ZetaBoard, please visit us at the new support board. Registration is free and easy.


Visit the NEW ZetaBoards Support forum!

Username:   Password:
Add Reply
Add Extra Field to Post; Made for Rovvrem Forums
Topic Started: Feb 9 2008, 01:36 PM (3,830 Views)
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 Goto Top
 
Victrixs
Member Avatar
Website Developer
[ *  *  * ]
where will this new feature be located at in the topic and what type of field can I add?
Offline Profile Quote Post Goto Top
 
Viral
Member Avatar
i'm stanley nao
[ *  *  *  *  * ]
Under Topic Description.

Anything, whatever is inputted in the input box will appear at the end of the post. If you don't input anything, it will not post and you will be alerted an error message. Not many people will use this, but Rovvrem asked for it, and I thought I would post it incase anyone else needed it as well.
Offline Profile Quote Post Goto Top
 
Victrixs
Member Avatar
Website Developer
[ *  *  * ]
I'll try to find a use for this and mebe I might use it. thanks great code.


P.S where does it go?
Edited by Victrixs, Feb 9 2008, 05:20 PM.
Offline Profile Quote Post Goto Top
 
Viral
Member Avatar
i'm stanley nao
[ *  *  *  *  * ]
Below the Board, or after Copyright.
Offline Profile Quote Post Goto Top
 
Nicola
Darth Vader's Sewing Instructor

Viral please read Stephen's post here and use proper syntax.
Quote:
 
With Javascripts for example, use proper syntax.


Zetaboards doesn't contain the following tags for the sake of it:
Code: HTML
 

<script type="text/javascript">
//<![CDATA[

... code

//]]>
</script>

Offline Profile Quote Post Goto Top
 
Rovvrem Forums
Member
[ * ]
Viral.

Big thanks for this.

Can I be cheeky and ask a few more favours :)

1/ Is it possible / How can I add more than one extra field.
2/ What would need to be edited so the extra text would be entered in the message body in the format in the code box below.

Code:
 
Source: [URL=http://www.Extrafield1.co.uk]ExtraField2.[/URL]


3/ Can I add an extra line break before the added text.


For anybody that is unsure of what this is for, my request is HERE.


For a preview, visit the Test board HERE. (The main board has not been Zeta'd yet :(
Go to the "Local News" section. (I have left this open to Guests.
When you create a "New Topic" you will see a new field (Source URL) where you type in the Topic Title.
what's entered in this field will be added to the end of the message.
Offline Profile Quote Post Goto Top
 
Viral
Member Avatar
i'm stanley nao
[ *  *  *  *  * ]
No problem Rovvrem, what you are asking for is just a few minor edits. I am currently working on some other codes at the moment, once finished I will re-do this for you.

Edit, Nicola:

I have no use for CDATA in the code as nothing there should not be XML parsed.
Edited by Viral, Feb 10 2008, 10:06 AM.
Offline Profile Quote Post Goto Top
 
Rovvrem Forums
Member
[ * ]
Cheers
Offline Profile Quote Post Goto Top
 
carastir
Member Avatar
Did you say something?
[ *  *  * ]
Viral
Feb 10 2008, 10:03 AM
I have no use for CDATA in the code as nothing there should not be XML parsed.
Then Read this: In Nicola's Blog
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
Go to Next Page
« Previous Topic · User Created Codes · Next Topic »
Add Reply