vForums Support Banner


Visit Base Classics - Gaming Chairs

 

Welcome Guest! Please Login or Register
vForums Support :: Programming & Coding :: Code Requests & Support :: [F] Posting Template Again.. - View Topic
Topic Rating: *****
Printable View
This topic was locked 21st Mar 08 at 9:35pm by Michael
dog199200
Guest
[F] Posting Template Again.. (16th Mar 08 at 9:27pm UTC)
Resolved
Ok can some help me fix the template, it aint spacing things out and for some reason it puts 2 n's after everything when the thread is posted.

Code:
 
  1. <script type="text/javascript">
  2. <!--
  3.  
  4. /* Predefined Posting Template/Form
  5.     Created by Ross of vForums
  6.     http://virtualforums.co.uk
  7.     Please do not repost outside of
  8.     vForums support without permission */
  9.  
  10. var _title = 'Character Profile';
  11.  
  12. var _description = 'Fill this out and post it to make your characters profile.';
  13.  
  14. var _fields = new Array(); var _f = 0;
  15.     _fields[_f++] = new Array('input', 'Character Full Name', ['size', 40, 'maxLength', 50], '', 'Your characters full name, first and last.', true);
  16.     _fields[_f++] = new Array('input', 'Character NickName', ['size', 40, 'maxLength', 50], '', 'Character Nickname (If Doesnt Got One Just Put * )', true);
  17.     _fields[_f++] = new Array('input', 'Character Title', ['size', 40, 'maxLength', 50], '', 'Does your character have a title that they go by? If so what is it?', false);
  18.     _fields[_f++] = new Array('input', 'Character Age', ['size', 40, 'maxLength', 50], '', 'Put Your characters age here.', true);
  19.     _fields[_f++] = new Array('input', 'Character Height', ['size', 40, 'maxLength', 50], '', 'Whats the height of your character?', true);
  20.     _fields[_f++] = new Array('select', 'Character Gender', false, ['Male', 'Female'], 'Whats your characters Gender?', true);
  21.     _fields[_f++] = new Array('input', 'Character Eye Color', ['size', 40, 'maxLength', 50], '', 'Whats your characters eye color?', true);
  22.     _fields[_f++] = new Array('input', 'Character Hair Color', ['size', 40, 'maxLength', 50], '', 'Whats your characters hair color?', true);
  23.     _fields[_f++] = new Array('input', 'Character Skin Color', ['size', 40, 'maxLength', 50], '', 'Whats your characters skin color?', true);
  24.     _fields[_f++] = new Array('input', 'Character Race', ['size', 40, 'maxLength', 200], '', 'Whats your characters Class?', true);
  25.     _fields[_f++] = new Array('select', 'Character Ailment', false, ['Good', 'Neutral', 'Evil'], 'Whats your characters Aliment?', true);
  26.     _fields[_f++] = new Array('input', '(If Any) Characters Alchemic Skills', ['size', 40, 'maxLength', 200], '', 'What are your characters Alchemic Skillz?', false);
  27.     _fields[_f++] = new Array('input', '(If Has One) Characters Military Position', ['size', 40, 'maxLength', 200], '', 'If you character is part of the military, what position is he/she?', false);
  28.     _fields[_f++] = new Array('select', 'Characters World', false, ['Amestris', 'Other Side Of The Gate'], 'What World is Your Character In?', true);
  29.     _fields[_f++] = new Array('input', 'Character Weapon', ['size', 40, 'maxLength', 50], '', 'Whats your characters Weapon?', false);
  30.     _fields[_f++] = new Array('textarea', 'Character Weapon Description', ['cols', 40, 'rows', 10], false, 'Whats the description of your characters weapon?', false);
  31.     _fields[_f++] = new Array('input', 'Character Description', ['size', 40, 'maxLength', 10], false, 'Whats your character looks like.', true);
  32.     _fields[_f++] = new Array('input', 'Character Picture', ['size', 40, 'maxLength', 10], false, 'This is a picture of what your character looks like.', false);
  33.     _fields[_f++] = new Array('textarea', 'Character Bio', ['cols', 40, 'rows', 10], false, 'Whats the story behind your character?', true);
  34.     _fields[_f++] = new Array('input', 'Password', ['size', 40, 'maxLength', 50], '', 'If you read the rules youd know what this means. (Most be filled in with the right password or your profile will not be accepted.', true);
  35.  
  36. var _widths = ['100%', '20%', '40%', '40%'];
  37.  
  38. var _posting_form = {
  39.  
  40.     errors: new Array(),
  41.  
  42.     init: function() {
  43.         this.create_form();
  44.     },
  45.     
  46.     create_form: function() {
  47.         // Create new post layout
  48.         var _holder = document.createElement('table');
  49.         _holder.setAttribute('className', 'border');
  50.         _holder.setAttribute('class', 'border');
  51.         _holder.setAttribute('cellSpacing','1');
  52.         _holder.setAttribute('cellPadding', '4');
  53.         _holder.setAttribute('align', 'center');
  54.         _holder.setAttribute('width', _widths[0]);
  55.         _holder.setAttribute('id', 'post_form_holder');
  56.         _holder.appendChild(document.createElement('tbody'));
  57.         _holder.firstChild.appendChild( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
  58.         _holder.firstChild.lastChild.lastChild.className = 'title1';
  59.         _holder.firstChild.lastChild.lastChild.colSpan = '3';
  60.         _holder.firstChild.lastChild.lastChild.lastChild.size = '2';
  61.         _holder.firstChild.lastChild.lastChild.lastChild.appendChild(document.createTextNode(_title));
  62.         if(_description) {
  63.             _holder.firstChild.appendChild( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
  64.             _holder.firstChild.lastChild.lastChild.setAttribute('className', 'window1');
  65.             _holder.firstChild.lastChild.lastChild.setAttribute('class', 'window1');
  66.             _holder.firstChild.lastChild.lastChild.setAttribute('colSpan', '3');
  67.             _holder.firstChild.lastChild.lastChild.lastChild.setAttribute('size', '2');
  68.             _holder.firstChild.lastChild.lastChild.lastChild.innerHTML = _description;
  69.         }
  70.         
  71.         for(_f=0; _f<_fields.length; _f++) {
  72.             switch(_fields[_f][0]) {
  73.                 case 'textarea' :
  74.                     var _tmp = document.createElement('textarea');
  75.                 break;
  76.                 
  77.                 case 'select' :
  78.                     var _tmp = document.createElement('select');
  79.                     for(_o=0; _o<_fields[_f][3].length; _o++) {
  80.                         _tmp.options[_o] = new Option(_fields[_f][3][_o], _fields[_f][3][_o]);
  81.                     }
  82.                 break;
  83.                 
  84.                 default :
  85.                     var _tmp = document.createElement('input');
  86.                     _tmp.type = 'text';
  87.                     if("undefined" != typeof _fields[_f][3] && _fields[_f][3] != "")
  88.                         _tmp.setAttribute('value', _fields[_f][3]);
  89.                 break;
  90.             }
  91.             _tmp.setAttribute('id', _f);
  92.             if("undefined" != typeof _fields[_f][2] && _fields[_f][2].length > 0) {
  93.                 for(_a=0; _a<_fields[_f][2].length; _a++) {
  94.                     _tmp.setAttribute(_fields[_f][2][_a++], _fields[_f][2][_a]);
  95.                 }
  96.             }
  97.             var _class = 'window' + ((_f % 2 == 0)? '2' : '1');
  98.             var _row = document.createElement('tr');
  99.             _row.appendChild(document.createElement('td'));
  100.             _row.lastChild.setAttribute('class', _class);
  101.             _row.lastChild.setAttribute('className', _class);
  102.             _row.lastChild.setAttribute('vAlign', 'top');
  103.             _row.lastChild.setAttribute('width', _widths[1]);
  104.             _row.lastChild.appendChild(document.createElement('font'));
  105.             _row.lastChild.lastChild.setAttribute('size', '2');
  106.             _row.lastChild.lastChild.style.fontWeight = 'bold';
  107.             _row.lastChild.lastChild.appendChild(document.createTextNode(_fields[_f][1] + ':'));
  108.             _row.appendChild(document.createElement('td'));
  109.             _row.lastChild.setAttribute('class', _class);
  110.             _row.lastChild.setAttribute('className', _class);
  111.             _row.lastChild.setAttribute('width', _widths[2]);
  112.             _row.lastChild.appendChild(document.createElement('font'));
  113.             _row.lastChild.lastChild.setAttribute('size', '2');
  114.             _row.lastChild.lastChild.appendChild(_tmp);
  115.             _row.appendChild(document.createElement('td'));
  116.             _row.lastChild.setAttribute('class', _class);
  117.             _row.lastChild.setAttribute('className', _class);
  118.             _row.lastChild.setAttribute('vAlign', 'top');
  119.             _row.lastChild.setAttribute('width', _widths[3]);
  120.             _row.lastChild.appendChild(document.createElement('font'));
  121.             _row.lastChild.lastChild.size = '1';
  122.             _row.lastChild.lastChild.appendChild(document.createTextNode(_fields[_f][4]));
  123.             _holder.firstChild.appendChild(_row);
  124.         }
  125.         var _submit = document.createElement('tr');
  126.         _submit.appendChild(document.createElement('td'));
  127.         _submit.lastChild.setAttribute('class', 'window' + (((_f+1) % 2 == 0)? '1' : '2'));
  128.         _submit.lastChild.setAttribute('className', 'window' + (((_f+1) % 2 == 0)? '1' : '2'));
  129.         _submit.lastChild.setAttribute('align', 'center');
  130.         _submit.lastChild.setAttribute('colSpan', 3);
  131.         var _button = document.createElement('input');
  132.         _button.setAttribute('type', 'button');
  133.         _button.setAttribute('value', 'Post Message');
  134.         _button.onclick = function() { _posting_form.post_it(); };
  135.         _submit.lastChild.appendChild(_button);
  136.         _holder.firstChild.appendChild(_submit);
  137.         document.post_form.style.display = 'none';
  138.         document.post_form.parentNode.insertBefore(_holder,  document.post_form);
  139.     },
  140.     
  141.     post_it: function() {
  142.         // create message and attempt to post it
  143.         this.errors = new Array();
  144.         document.post_form.message.value = document.post_form.subject.value = '';
  145.         var _sub = document.getElementById('0').value;
  146.         _fields[0][5] = true;
  147.         document.post_form.subject.value    = _sub;
  148.         for(_f=0; _f<_fields.length; _f++) {
  149.             if(document.getElementById(_f)) {
  150.                 _value = document.getElementById(_f).value;
  151.                 if(!_value || _value.match(/^s*$/)) {
  152.                     if(_f > 0 && _fields[_f][5])
  153.                         this.show_error('You have left the ' + _fields[_f][1] + ' option empty. This is a required field and as such must contain a value.');
  154.                     else
  155.                         _value = '[i]None[/i]';
  156.                 }
  157.                 document.post_form.message.value += '[b]' + _fields[_f][1] + ':[/b] ' + _value + 'nn';
  158.             }
  159.         }
  160.         if(this.errors.length == 0)
  161.             document.post_form.post.click();
  162.         else
  163.             this.show_error();
  164.     },
  165.     
  166.     show_error: function() {
  167.         if("undefined" != typeof arguments[0] && arguments[0]) {
  168.             this.errors.push(arguments[0]);
  169.         } else {
  170.             // Show Errors
  171.             if(document.getElementById('status_holder')) {
  172.                 document.getElementById('status_holder_title').innerHTML = "An Error Has Occured";
  173.                 document.getElementById('status_holder_message').innerHTML = this.errors.join("<br />");
  174.                 document.getElementById('status_holder').style.display = 'block';
  175.             }
  176.         }
  177.     }
  178. }
  179.  
  180.  
  181. if(document.post_form && location.href.match(/action\/post\/?$/) && vf_username != 'Guest') {
  182.     _posting_form.init();
  183. }
  184.  
  185. //-->
  186. </script>
 




(One sec i will get the code, for some reason i'm getting a seer error)
Michael
Moderator
*****

[Avatar]
Recoding the future

Posts: 4,043
Status: Offline
Gender: Male
Location: UK
Joined:  

Additional Groups:
Coding Team
***


Reputation: 58%  


pmtwittervForum
Re: Posting Template Again.. (16th Mar 08 at 9:29pm UTC)
The server error is a problem that the server is experiencing. Please bare with us
dog199200
Guest
Re: Posting Template Again.. (17th Mar 08 at 10:51pm UTC)
ok sorry about that, code posted
Michael
Moderator
*****

[Avatar]
Recoding the future

Posts: 4,043
Status: Offline
Gender: Male
Location: UK
Joined:  

Additional Groups:
Coding Team
***


Reputation: 58%  


pmtwittervForum
Re: Posting Template Again.. (18th Mar 08 at 7:25pm UTC)
again, this works fine on my testboard:

http://wrighty.virtualforums.co.uk/board/test/action/post/

{Unsure}
dog199200
Guest
Re: Posting Template Again.. (18th Mar 08 at 10:20pm UTC)
ok i'll contact ross again....
Marc
vChat Developer
*****
I <3 Rossy

Posts: 3,388
Status: Offline
Gender: Male
Location: Ontario, Canada
Age: 32
Joined:  

Additional Groups:
Coding Team
***


Reputation: 40%  


pmwww
Re: Posting Template Again.. (18th Mar 08 at 10:42pm UTC)
Could we get a link to the board this is being used on, please?

rroll.to— Shorten a link, rickroll your friends.
dog199200
Guest
Re: Posting Template Again.. (19th Mar 08 at 4:07am UTC)
ah ok sorry about that there is now two board its doing it on and one is on another forum so heres the links

http://fmaadvanced.virtualforums.co.uk/board/Cprofile/

http://deluxeanimeforum.vforums.co.uk/board/Charactorpro/
Michael
Moderator
*****

[Avatar]
Recoding the future

Posts: 4,043
Status: Offline
Gender: Male
Location: UK
Joined:  

Additional Groups:
Coding Team
***


Reputation: 58%  


pmtwittervForum
Re: Posting Template Again.. (20th Mar 08 at 12:49am UTC)
I'm not getting any problem on those boards! {Unsure}
Marc
vChat Developer
*****
I <3 Rossy

Posts: 3,388
Status: Offline
Gender: Male
Location: Ontario, Canada
Age: 32
Joined:  

Additional Groups:
Coding Team
***


Reputation: 40%  


pmwww
Re: Posting Template Again.. (20th Mar 08 at 1:57am UTC)
Make sure the code is at the very top of the board footers. Also, which browser are you using?

rroll.to— Shorten a link, rickroll your friends.
dog199200
Guest
Re: Posting Template Again.. (20th Mar 08 at 10:56pm UTC)
i'm using FF and its the only code in the boards footer...

Edit: ok i posted a thread to show as a test:

http://deluxeanimeforum.vforums.co.uk/board/Charactorpro/action/view_topic/topic/102/page/1/#post-1206053857

i put all f's and you can see that for some reason it put two n's at the end of everything as well as it pushed everything together and didn't space the topics out..
Michael
Moderator
*****

[Avatar]
Recoding the future

Posts: 4,043
Status: Offline
Gender: Male
Location: UK
Joined:  

Additional Groups:
Coding Team
***


Reputation: 58%  


pmtwittervForum
Re: Posting Template Again.. (20th Mar 08 at 11:00pm UTC)
oh ok. Didn't know that was the problem! {Tongue Out} It's cause some \ got removed during older versions of vF.

Could you copy the code that I posted on the 2nd page (I think) of the same thread?
dog199200
Guest
Re: Posting Template Again.. (20th Mar 08 at 11:04pm UTC)
ah ok will do

Edit: ok that works ty {Smile}
 Printable View

All times are GMT+0 :: The current time is 10:12pm
Page generated in 1.7116 seconds
This Forum is Powered By vForums (v2.4)
Create a Forum for Free | Find Forums