vForums Support > Programming & Coding :: Database of Codes/Hacks/Mods :: > Predefined Posting Template/Form

Predefined Posting Template/Form - Posted By Ross (admin) on 26th Nov 07 at 11:59pm
This code can be used to give users a custom posting form in order to ensure they provide certain information when posting. Common uses of this include graphics request forms and RPG character creation.

The code should be placed in the footer of the board you wish to use it on. To do this, go to the "Headers and Footer" section of your admin panel found in the "Site Design" section. From this page you can select the board you wish to use it on and press "continue" so you are presented with the text areas representing the header and footer of your forum.

Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. /* Predefined Posting Template/Form
  4.     Created by Ross of vForums
  5.     http://virtualforums.co.uk
  6.     Please do not repost outside of
  7.     vForums support without permission */
  8. var _title = 'New Code Request';
  9. var _description = 'Please ensure you have a read of the <a href="URL">Rules</a> before posting';
  10. var _fields = new Array(); var _f = 0;
  11.     _fields[_f++] = new Array('input', 'Description', ['size', 40, 'maxLength', 50], '', 'Please give a short description of what it is you\'re after. Include any relevant keywords.', false);
  12.     _fields[_f++] = new Array('select', 'Type', false, ['All Pages', 'Main Page', 'Mini-Profile', 'Info Center', 'Private Messaging', 'Profile', 'Posting', 'Thread Listing', 'Welcome Table', 'Other'], 'Select the category/area that best fits the type of code you\'re after.', true);
  13.     _fields[_f++] = new Array('input', 'Example', ['size', 40, 'maxLength', 200], false, 'If you have an example of what you want to achieve, please link to it here. This can be anything from an image of what you need to a link to a forum using the code you want.', false);
  14.     _fields[_f++] = new Array('textarea', 'Request Details', ['cols', 40, 'rows', 10], false, 'Please give as much information as possible about your request. The more information you give now, the easier it will be for someone to fill your request.', true);
  15. var _widths = ['100%', '20%', '40%', '40%'];
  16. var _posting_form = {
  17.     errors: new Array(),
  18.     init: function() {
  19.         this.create_form();
  20.     },
  21.     
  22.     create_form: function() {
  23.         // Create new post layout
  24.         var _holder = document.createElement('table');
  25.         _holder.setAttribute('className', 'border');
  26.         _holder.setAttribute('class', 'border');
  27.         _holder.setAttribute('cellSpacing','1');
  28.         _holder.setAttribute('cellPadding', '4');
  29.         _holder.setAttribute('align', 'center');
  30.         _holder.setAttribute('width', _widths[0]);
  31.         _holder.setAttribute('id', 'post_form_holder');
  32.         _holder.appendChild(document.createElement('tbody'));
  33.         _holder.firstChild.appendChild( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
  34.         _holder.firstChild.lastChild.lastChild.className = 'title1';
  35.         _holder.firstChild.lastChild.lastChild.colSpan = '3';
  36.         _holder.firstChild.lastChild.lastChild.lastChild.size = '2';
  37.         _holder.firstChild.lastChild.lastChild.lastChild.appendChild(document.createTextNode(_title));
  38.         if(_description) {
  39.             _holder.firstChild.appendChild( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
  40.             _holder.firstChild.lastChild.lastChild.setAttribute('className', 'window1');
  41.             _holder.firstChild.lastChild.lastChild.setAttribute('class', 'window1');
  42.             _holder.firstChild.lastChild.lastChild.setAttribute('colSpan', '3');
  43.             _holder.firstChild.lastChild.lastChild.lastChild.setAttribute('size', '2');
  44.             _holder.firstChild.lastChild.lastChild.lastChild.innerHTML = _description;
  45.         }
  46.         
  47.         for(_f=0; _f<_fields.length; _f++) {
  48.             switch(_fields[_f][0]) {
  49.                 case 'textarea' :
  50.                     var _tmp = document.createElement('textarea');
  51.                 break;
  52.                 
  53.                 case 'select' :
  54.                     var _tmp = document.createElement('select');
  55.                     for(_o=0; _o<_fields[_f][3].length; _o++) {
  56.                         _tmp.options[_o] = new Option(_fields[_f][3][_o], _fields[_f][3][_o]);
  57.                     }
  58.                 break;
  59.                 
  60.                 default :
  61.                     var _tmp = document.createElement('input');
  62.                     _tmp.type = 'text';
  63.                     if("undefined" != typeof _fields[_f][3] && _fields[_f][3] != "")
  64.                         _tmp.setAttribute('value', _fields[_f][3]);
  65.                 break;
  66.             }
  67.             _tmp.setAttribute('id', _f);
  68.             if("undefined" != typeof _fields[_f][2] && _fields[_f][2].length > 0) {
  69.                 for(_a=0; _a<_fields[_f][2].length; _a++) {
  70.                     _tmp.setAttribute(_fields[_f][2][_a++], _fields[_f][2][_a]);
  71.                 }
  72.             }
  73.             var _class = 'window' + ((_f % 2 == 0)? '2' : '1');
  74.             var _row = document.createElement('tr');
  75.             _row.appendChild(document.createElement('td'));
  76.             _row.lastChild.setAttribute('class', _class);
  77.             _row.lastChild.setAttribute('className', _class);
  78.             _row.lastChild.setAttribute('vAlign', 'top');
  79.             _row.lastChild.setAttribute('width', _widths[1]);
  80.             _row.lastChild.appendChild(document.createElement('font'));
  81.             _row.lastChild.lastChild.setAttribute('size', '2');
  82.             _row.lastChild.lastChild.style.fontWeight = 'bold';
  83.             _row.lastChild.lastChild.appendChild(document.createTextNode(_fields[_f][1] + ':'));
  84.             _row.appendChild(document.createElement('td'));
  85.             _row.lastChild.setAttribute('class', _class);
  86.             _row.lastChild.setAttribute('className', _class);
  87.             _row.lastChild.setAttribute('width', _widths[2]);
  88.             _row.lastChild.appendChild(document.createElement('font'));
  89.             _row.lastChild.lastChild.setAttribute('size', '2');
  90.             _row.lastChild.lastChild.appendChild(_tmp);
  91.             _row.appendChild(document.createElement('td'));
  92.             _row.lastChild.setAttribute('class', _class);
  93.             _row.lastChild.setAttribute('className', _class);
  94.             _row.lastChild.setAttribute('vAlign', 'top');
  95.             _row.lastChild.setAttribute('width', _widths[3]);
  96.             _row.lastChild.appendChild(document.createElement('font'));
  97.             _row.lastChild.lastChild.size = '1';
  98.             _row.lastChild.lastChild.appendChild(document.createTextNode(_fields[_f][4]));
  99.             _holder.firstChild.appendChild(_row);
  100.         }
  101.         var _submit = document.createElement('tr');
  102.         _submit.appendChild(document.createElement('td'));
  103.         _submit.lastChild.setAttribute('class', 'window' + (((_f+1) % 2 == 0)? '1' : '2'));
  104.         _submit.lastChild.setAttribute('className', 'window' + (((_f+1) % 2 == 0)? '1' : '2'));
  105.         _submit.lastChild.setAttribute('align', 'center');
  106.         _submit.lastChild.setAttribute('colSpan', 3);
  107.         var _button = document.createElement('input');
  108.         _button.setAttribute('type', 'button');
  109.         _button.setAttribute('value', 'Post Message');
  110.         _button.onclick = function() { _posting_form.post_it(); };
  111.         _submit.lastChild.appendChild(_button);
  112.         _holder.firstChild.appendChild(_submit);
  113.         document.post_form.style.display = 'none';
  114.         document.post_form.parentNode.insertBefore(_holder,  document.post_form);
  115.     },
  116.     
  117.     post_it: function() {
  118.         // create message and attempt to post it
  119.         this.errors = new Array();
  120.         document.post_form.message.value = document.post_form.subject.value = '';
  121.         var _sub = document.getElementById('0').value;
  122.         _fields[0][5] = true;
  123.         document.post_form.subject.value    = _sub;
  124.         for(_f=0; _f<_fields.length; _f++) {
  125.             if(document.getElementById(_f)) {
  126.                 _value = document.getElementById(_f).value;
  127.                 if(!_value || _value.match(/^s*$/)) {
  128.                     if(_f > 0 && _fields[_f][5])
  129.                         this.show_error('You have left the ' + _fields[_f][1] + ' option empty. This is a required field and as such must contain a value.');
  130.                     else
  131.                         _value = 'None';
  132.                 }
  133.                 document.post_form.message.value += '' + _fields[_f][1] + ': ' + _value + '\n\n';
  134.             }
  135.         }
  136.         if(this.errors.length == 0)
  137.             document.post_form.post.click();
  138.         else
  139.             this.show_error();
  140.     },
  141.     
  142.     show_error: function() {
  143.         if("undefined" != typeof arguments[0] && arguments[0]) {
  144.             this.errors.push(arguments[0]);
  145.         } else {
  146.             // Show Errors
  147.             if(document.getElementById('status_holder')) {
  148.                 document.getElementById('status_holder_title').innerHTML = "An Error Has Occured";
  149.                 document.getElementById('status_holder_message').innerHTML = this.errors.join("<br />");
  150.                 document.getElementById('status_holder').style.display = 'block';
  151.             }
  152.         }
  153.     }
  154. }
  155. if(document.post_form && location.href.match(/action\/post\/?$/) && vf_username != 'Guest') {
  156.     _posting_form.init();
  157. }
  158. //-->
  159. </script>
 





Editing the Code
The following sections are the parts of the code that should be edited to suit your application of the code:
var _title = 'New Code Request'; // the name of your form

var _description = 'Please ensure you have a read of the <a href="URL">Rules</a> before posting'; // this is the description of the form telling users what to do

var _fields = new Array(); var _f = 0; // See below for editing instructions on this section
 _fields[_f++] = new Array('input', 'Description', ['size', 40, 'maxLength', 50], '', 'Please give a short description of what it is you're after. Include any relevant keywords.', false);
_fields[_f++] = new Array('select', 'Type', false, ['All Pages', 'Main Page', 'Mini-Profile', 'Info Center', 'Private Messaging', 'Profile', 'Posting', 'Thread Listing', 'Welcome Table', 'Other'], 'Select the category/area that best fits the type of code you're after.', true);
_fields[_f++] = new Array('input', 'Example', ['size', 40, 'maxLength', 200], false, 'If you have an example of what you want to achieve, please link to it here. This can be anything from an image of what you need to a link to a forum using the code you want.', false);
_fields[_f++] = new Array('textarea', 'Request Details', ['cols', 40, 'rows', 10], false, 'Please give as much information as possible about your request. The more information you give now, the easier it will be for someone to fill your request.', true);


var _widths = ['100%', '20%', '40%', '40%']; // These are the widths of each box. You may need to alter them to prevent lines being streyched if you use a thin width.

 
The parts highlighted in red are the actual posting fields. There are 3 types of field you can use, an example of each is given below where:

The blue parts are the attributes for this field, unless you know HTML it's probably best to leave them as they are.
The purple true/flase sets if the field is a required field or not (false means it can be left blank).

You can list as many different fields as necessary where shown above. The first field will always be the subject of the posted message. Some general rules to remember when editing these fields are that you cannot place an apostrophe in any of the fields without first escaping it with a backslash '. Also, you cannot put in any line breaks/returns by pressing the enter key, to insert a new line into a description use <br />

Single Line Input:
_fields[_f++] = new Array('input', 'Field Name, ie. "Character Name" or "Description"', ['size', 40, 'maxLength', 50], 'Default Value filled in when the form loads. Can be left blank', 'A short description of what the field is for', false);


Drop down menu:
_fields[_f++] = new Array('select', 'Field Name, ie. "Gender" or "Type"', [], ['All Pages', 'Main Page', 'Mini-Profile', 'Info Center', 'Private Messaging', 'Profile', 'Posting', 'Thread Listing', 'Welcome Table', 'Other'], 'A short description of what the field is for.', true);

Here, the red represents the different options. Each option should be wrapped in single quotation marks (') and seperated by a comma (,)


Multiple-Line Text Area:
_fields[_f++] = new Array('textarea', 'Field Name, ie. "History" or "Further Details"', ['cols', 40, 'rows', 10], 'Default Value', 'A short description of what the field is for.', false);



If you have any trouble editing the form as you need it then please post below or in the support board with the part you have edited (there's no need to post the whole code) and the URL to where you're trying to use it


- Ross

Re: Predefined Posting Template/Form - Posted By Nick (nickb) on 29th Nov 07 at 2:00am
Is this Cross Browser?

~Darkmage

Re: Predefined Posting Template/Form - Posted By Ross (admin) on 29th Nov 07 at 9:57am
It should, at the very least, be working with Internet Explorer 6+ and Firefox 2+. I've not tested it in any other browsers like Opera or Safari.

Re: Predefined Posting Template/Form - Posted By Nick (nickb) on 30th Nov 07 at 1:07am
ok I only use Fire Fox, So then It should work, this would be good for my Advertising forum.

EDIT: I need help with this Code, I will Pm you what I need done with it.

Re: Predefined Posting Template/Form - Posted By Nick (nickb) on 2nd Dec 07 at 6:53am
This does not work. I put it in the boards footer I wanted it to be in, but it does not show up. I am giving you an example of what I mean:

Preview

~Darkmage

Re: Predefined Posting Template/Form - Posted By Ross (admin) on 2nd Dec 07 at 7:47pm
The code works fine. You had just missed the </script> off of the end. I've added it back for you and it's now loading OK.

Re: Predefined Posting Template/Form - Posted By Nick (nickb) on 3rd Dec 07 at 12:55am
 
The code works fine. You had just missed the </script> off of the end. I've added it back for you and it's now loading OK.


{Embarassed} Whoops, lol. Sorry, I Guess I missed that when copying the code. {Tongue Out}

~Darkmage

Re: Predefined Posting Template/Form - Posted By Nick (nickb) on 9th Dec 07 at 12:17am
Hey the Code doesn't Separate its self when you post.

Example

~Darkmage

Re: Predefined Posting Template/Form - Posted By Ross (admin) on 9th Dec 07 at 12:40am
OK, I've made a fix to the code in the first post. For some reason I had lost the backslashes {Embarassed}

Re: Predefined Posting Template/Form - Posted By Nick (nickb) on 9th Dec 07 at 12:46am
 
OK, I've made a fix to the code in the first post. For some reason I had lost the backslashes {Embarassed}


Ahh I see, and do I have to put the backslashes, or can you on my code?

Edit: Ahh I see the banner was to big in my sigy, I can resize it. What is the specific Height and length? I know for PB its 500x250.

Re: Predefined Posting Template/Form - Posted By Ross (admin) on 9th Dec 07 at 12:58am
Ah yeah, I forgot you had a customised version:

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 = 'New Code Request';
  11.  
  12. var _description = 'Please ensure you have a read of the <a href="URL">Rules</a> before posting';
  13.  
  14. var _fields = new Array(); var _f = 0;
  15.     _fields[_f++] = new Array('input', 'Name of Website', ['size', 40, 'maxLength', 50], '', 'What is the name of your forum?', false);
  16.     _fields[_f++] = new Array('input', 'Username', ['size', 40, 'maxLength', 50], '', 'What is your Username on that forum?', false);
  17.     _fields[_f++] = new Array('input', 'Genre', ['size', 40, 'maxLength', 50], '', 'What Genre is your forum? IE: RPG, General, Coding ETC.', false);
  18.     _fields[_f++] = new Array('input', 'URL of Site/Forum', ['size', 40, 'maxLength', 250], '', 'Please give us your forums link.', false);
  19.     _fields[_f++] = new Array('textarea', 'Affiliate Code', ['cols', 40, 'rows', 3], '', 'Please give us your forums Affiliate Code.', false);
  20.     _fields[_f++] = new Array('input', 'Referral', ['size', 40, 'maxLength', 350], '', 'How did you find our forum? IE: Google, Advertisements, Affiliates ETC.', false);
  21.     _fields[_f++] = new Array('textarea', 'Description', ['cols', 40, 'rows', 4], '', 'Please give a Brief Description of your forum.', false);
  22.     _fields[_f++] = new Array('textarea', 'Additional Comments', ['cols', 40, 'rows', 4], '', 'Do you have any Comments Regarding our Forum, or your forum?', false);
  23.  
  24.  
  25. var _widths = ['100%', '20%', '40%', '40%'];
  26.  
  27. var _posting_form = {
  28.  
  29.     errors: new Array(),
  30.  
  31.     init: function() {
  32.         this.create_form();
  33.     },
  34.     
  35.     create_form: function() {
  36.         // Create new post layout
  37.         var _holder = document.createElement('table');
  38.         _holder.setAttribute('className', 'border');
  39.         _holder.setAttribute('class', 'border');
  40.         _holder.setAttribute('cellSpacing','1');
  41.         _holder.setAttribute('cellPadding', '4');
  42.         _holder.setAttribute('align', 'center');
  43.         _holder.setAttribute('width', _widths[0]);
  44.         _holder.setAttribute('id', 'post_form_holder');
  45.         _holder.appendChild(document.createElement('tbody'));
  46.         _holder.firstChild.appendChild( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
  47.         _holder.firstChild.lastChild.lastChild.className = 'title1';
  48.         _holder.firstChild.lastChild.lastChild.colSpan = '3';
  49.         _holder.firstChild.lastChild.lastChild.lastChild.size = '2';
  50.         _holder.firstChild.lastChild.lastChild.lastChild.appendChild(document.createTextNode(_title));
  51.         if(_description) {
  52.             _holder.firstChild.appendChild( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
  53.             _holder.firstChild.lastChild.lastChild.setAttribute('className', 'window1');
  54.             _holder.firstChild.lastChild.lastChild.setAttribute('class', 'window1');
  55.             _holder.firstChild.lastChild.lastChild.setAttribute('colSpan', '3');
  56.             _holder.firstChild.lastChild.lastChild.lastChild.setAttribute('size', '2');
  57.             _holder.firstChild.lastChild.lastChild.lastChild.innerHTML = _description;
  58.         }
  59.         
  60.         for(_f=0; _f<_fields.length; _f++) {
  61.             switch(_fields[_f][0]) {
  62.                 case 'textarea' :
  63.                     var _tmp = document.createElement('textarea');
  64.                 break;
  65.                 
  66.                 case 'select' :
  67.                     var _tmp = document.createElement('select');
  68.                     for(_o=0; _o<_fields[_f][3].length; _o++) {
  69.                         _tmp.options[_o] = new Option(_fields[_f][3][_o], _fields[_f][3][_o]);
  70.                     }
  71.                 break;
  72.                 
  73.                 default :
  74.                     var _tmp = document.createElement('input');
  75.                     _tmp.type = 'text';
  76.                     if("undefined" != typeof _fields[_f][3] && _fields[_f][3] != "")
  77.                         _tmp.setAttribute('value', _fields[_f][3]);
  78.                 break;
  79.             }
  80.             _tmp.setAttribute('id', _f);
  81.             if("undefined" != typeof _fields[_f][2] && _fields[_f][2].length > 0) {
  82.                 for(_a=0; _a<_fields[_f][2].length; _a++) {
  83.                     _tmp.setAttribute(_fields[_f][2][_a++], _fields[_f][2][_a]);
  84.                 }
  85.             }
  86.             var _class = 'window' + ((_f % 2 == 0)? '2' : '1');
  87.             var _row = document.createElement('tr');
  88.             _row.appendChild(document.createElement('td'));
  89.             _row.lastChild.setAttribute('class', _class);
  90.             _row.lastChild.setAttribute('className', _class);
  91.             _row.lastChild.setAttribute('vAlign', 'top');
  92.             _row.lastChild.setAttribute('width', _widths[1]);
  93.             _row.lastChild.appendChild(document.createElement('font'));
  94.             _row.lastChild.lastChild.setAttribute('size', '2');
  95.             _row.lastChild.lastChild.style.fontWeight = 'bold';
  96.             _row.lastChild.lastChild.appendChild(document.createTextNode(_fields[_f][1] + ':'));
  97.             _row.appendChild(document.createElement('td'));
  98.             _row.lastChild.setAttribute('class', _class);
  99.             _row.lastChild.setAttribute('className', _class);
  100.             _row.lastChild.setAttribute('width', _widths[2]);
  101.             _row.lastChild.appendChild(document.createElement('font'));
  102.             _row.lastChild.lastChild.setAttribute('size', '2');
  103.             _row.lastChild.lastChild.appendChild(_tmp);
  104.             _row.appendChild(document.createElement('td'));
  105.             _row.lastChild.setAttribute('class', _class);
  106.             _row.lastChild.setAttribute('className', _class);
  107.             _row.lastChild.setAttribute('vAlign', 'top');
  108.             _row.lastChild.setAttribute('width', _widths[3]);
  109.             _row.lastChild.appendChild(document.createElement('font'));
  110.             _row.lastChild.lastChild.size = '1';
  111.             _row.lastChild.lastChild.appendChild(document.createTextNode(_fields[_f][4]));
  112.             _holder.firstChild.appendChild(_row);
  113.         }
  114.         var _submit = document.createElement('tr');
  115.         _submit.appendChild(document.createElement('td'));
  116.         _submit.lastChild.setAttribute('class', 'window' + (((_f+1) % 2 == 0)? '1' : '2'));
  117.         _submit.lastChild.setAttribute('className', 'window' + (((_f+1) % 2 == 0)? '1' : '2'));
  118.         _submit.lastChild.setAttribute('align', 'center');
  119.         _submit.lastChild.setAttribute('colSpan', 3);
  120.         var _button = document.createElement('input');
  121.         _button.setAttribute('type', 'button');
  122.         _button.setAttribute('value', 'Post Message');
  123.         _button.onclick = function() { _posting_form.post_it(); };
  124.         _submit.lastChild.appendChild(_button);
  125.         _holder.firstChild.appendChild(_submit);
  126.         document.post_form.style.display = 'none';
  127.         document.post_form.parentNode.insertBefore(_holder,  document.post_form);
  128.     },
  129.     
  130.     post_it: function() {
  131.         // create message and attempt to post it
  132.         this.errors = new Array();
  133.         document.post_form.message.value = document.post_form.subject.value = '';
  134.         var _sub = document.getElementById('0').value;
  135.         _fields[0][5] = true;
  136.         document.post_form.subject.value    = _sub;
  137.         for(_f=0; _f<_fields.length; _f++) {
  138.             if(document.getElementById(_f)) {
  139.                 _value = document.getElementById(_f).value;
  140.                 if(!_value || _value.match(/^s*$/)) {
  141.                     if(_f > 0 && _fields[_f][5])
  142.                         this.show_error('You have left the ' + _fields[_f][1] + ' option empty. This is a required field and as such must contain a value.');
  143.                     else
  144.                         _value = '[i]None[/i]';
  145.                 }
  146.                 document.post_form.message.value += '[b]' + _fields[_f][1] + ':[/b] ' + _value + '\n\n';
  147.             }
  148.         }
  149.         if(this.errors.length == 0)
  150.             document.post_form.post.click();
  151.         else
  152.             this.show_error();
  153.     },
  154.     
  155.     show_error: function() {
  156.         if("undefined" != typeof arguments[0] && arguments[0]) {
  157.             this.errors.push(arguments[0]);
  158.         } else {
  159.             // Show Errors
  160.             if(document.getElementById('status_holder')) {
  161.                 document.getElementById('status_holder_title').innerHTML = "An Error Has Occured";
  162.                 document.getElementById('status_holder_message').innerHTML = this.errors.join("<br />");
  163.                 document.getElementById('status_holder').style.display = 'block';
  164.             }
  165.         }
  166.     }
  167. }
  168.  
  169.  
  170. if(document.post_form && location.href.match(/action\/post\/?$/) && vf_username != 'Guest') {
  171.     _posting_form.init();
  172. }
  173.  
  174. //-->
  175. </script>
 


For the banner, for now I'd rather images were kept to about 150px high. At least until I arrange some user preference for hiding signatures / large images {Smile}

Re: Predefined Posting Template/Form - Posted By Nick (nickb) on 9th Dec 07 at 1:02am
thanks, and I will keep that number in mind.

Re: Predefined Posting Template/Form - Posted By Nick (nickb) on 18th Dec 07 at 7:57pm
http://vfad.virtualforums.co.uk/board/Advertise/action/post/

The code does not work again {Unsure}

~Darkmage

Re: Predefined Posting Template/Form - Posted By Ross (admin) on 18th Dec 07 at 8:40pm
Should be working now?

Re: Predefined Posting Template/Form - Posted By Nick (nickb) on 26th Dec 07 at 8:16am
I don't think I did this right, when I try to post, it wont show up. Here is the code:

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 RP form';
  11.  
  12. var _description = '';
  13.  
  14. var _fields = new Array(); var _f = 0;
  15.     _fields[_f++] = new Array('input', 'Character name', ['size', 40, 'maxLength', 50], '', 'What is the name of your role-play character?', false);
  16.     _fields[_f++] = new Array('input', 'Age', ['size', 40, 'maxLength', 50], '', 'What is your role-play characters age?', false);
  17.     _fields[_f++] = new Array('input', 'Gender', ['size', 40, 'maxLength', 50], '', 'What is the gender of your RP character?', false);
  18.     _fields[_f++] = new Array('input', 'Species', ['size', 40, 'maxLength', 250], '', 'What is your characters Species?.', false);
  19.     _fields[_f++] = new Array('input', 'Good/Evil/Neutral', ['cols', 40, 'rows', 3], '', 'Please tell us if you are good, evil, or neutral.', false);
  20.     _fields[_f++] = new Array('textarea', 'Appearance', ['size', 40, 'maxLength', 350], '', 'Please give a description of your characters appearence.', false);
  21.     _fields[_f++] = new Array('textarea', 'Personality', ['cols', 40, 'rows', 4], '', 'What is your character personality like?.', false);
  22.     _fields[_f++] = new Array('textarea', 'History', ['size', 40, 'maxLength', 350], '', 'Please tell us you characters history.', false);
  23.     _fields[_f++] = new Array('textarea', 'Abilities', ['cols', 40, 'rows', 4], '', 'Please list your characters abilities', false);
  24.     _fields[_f++] = new Array('textarea', 'Weapon', ['cols', 40, 'rows', 4], '', 'What are your weapon(s)?', false);
  25.     _fields[_f++] = new Array('textarea', 'Hobbies', ['cols', 40, 'rows', 4], '', 'What are your characters hobbies?', false);
  26.     _fields[_f++] = new Array('textarea', 'Jobs', ['cols', 40, 'rows', 4], '', 'What kind of job does your character do? IE: Soldier, merchant, unemployed, etc.', false);
  27.     _fields[_f++] = new Array('textarea', 'Summons', ['cols', 40, 'rows', 4], '', 'What are your characters summons if any?' , false);
  28.  
  29.  
  30. var _widths = ['100%', '20%', '40%', '40%'];
  31.  
  32. var _posting_form = {
  33.  
  34.     errors: new Array(),
  35.  
  36.     init: function() {
  37.         this.create_form();
  38.     },
  39.     
  40.     create_form: function() {
  41.         // Create new post layout
  42.         var _holder = document.createElement('table');
  43.         _holder.setAttribute('className', 'border');
  44.         _holder.setAttribute('class', 'border');
  45.         _holder.setAttribute('cellSpacing','1');
  46.         _holder.setAttribute('cellPadding', '4');
  47.         _holder.setAttribute('align', 'center');
  48.         _holder.setAttribute('width', _widths[0]);
  49.         _holder.setAttribute('id', 'post_form_holder');
  50.         _holder.appendChild(document.createElement('tbody'));
  51.         _holder.firstChild.appendChild( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
  52.         _holder.firstChild.lastChild.lastChild.className = 'title1';
  53.         _holder.firstChild.lastChild.lastChild.colSpan = '3';
  54.         _holder.firstChild.lastChild.lastChild.lastChild.size = '2';
  55.         _holder.firstChild.lastChild.lastChild.lastChild.appendChild(document.createTextNode(_title));
  56.         if(_description) {
  57.             _holder.firstChild.appendChild( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
  58.             _holder.firstChild.lastChild.lastChild.setAttribute('className', 'window1');
  59.             _holder.firstChild.lastChild.lastChild.setAttribute('class', 'window1');
  60.             _holder.firstChild.lastChild.lastChild.setAttribute('colSpan', '3');
  61.             _holder.firstChild.lastChild.lastChild.lastChild.setAttribute('size', '2');
  62.             _holder.firstChild.lastChild.lastChild.lastChild.innerHTML = _description;
  63.         }
  64.         
  65.         for(_f=0; _f<_fields.length; _f++) {
  66.             switch(_fields[_f][0]) {
  67.                 case 'textarea' :
  68.                     var _tmp = document.createElement('textarea');
  69.                 break;
  70.                 
  71.                 case 'select' :
  72.                     var _tmp = document.createElement('select');
  73.                     for(_o=0; _o<_fields[_f][3].length; _o++) {
  74.                         _tmp.options[_o] = new Option(_fields[_f][3][_o], _fields[_f][3][_o]);
  75.                     }
  76.                 break;
  77.                 
  78.                 default :
  79.                     var _tmp = document.createElement('input');
  80.                     _tmp.type = 'text';
  81.                     if("undefined" != typeof _fields[_f][3] && _fields[_f][3] != "")
  82.                         _tmp.setAttribute('value', _fields[_f][3]);
  83.                 break;
  84.             }
  85.             _tmp.setAttribute('id', _f);
  86.             if("undefined" != typeof _fields[_f][2] && _fields[_f][2].length > 0) {
  87.                 for(_a=0; _a<_fields[_f][2].length; _a++) {
  88.                     _tmp.setAttribute(_fields[_f][2][_a++], _fields[_f][2][_a]);
  89.                 }
  90.             }
  91.             var _class = 'window' + ((_f % 2 == 0)? '2' : '1');
  92.             var _row = document.createElement('tr');
  93.             _row.appendChild(document.createElement('td'));
  94.             _row.lastChild.setAttribute('class', _class);
  95.             _row.lastChild.setAttribute('className', _class);
  96.             _row.lastChild.setAttribute('vAlign', 'top');
  97.             _row.lastChild.setAttribute('width', _widths[1]);
  98.             _row.lastChild.appendChild(document.createElement('font'));
  99.             _row.lastChild.lastChild.setAttribute('size', '2');
  100.             _row.lastChild.lastChild.style.fontWeight = 'bold';
  101.             _row.lastChild.lastChild.appendChild(document.createTextNode(_fields[_f][1] + ':'));
  102.             _row.appendChild(document.createElement('td'));
  103.             _row.lastChild.setAttribute('class', _class);
  104.             _row.lastChild.setAttribute('className', _class);
  105.             _row.lastChild.setAttribute('width', _widths[2]);
  106.             _row.lastChild.appendChild(document.createElement('font'));
  107.             _row.lastChild.lastChild.setAttribute('size', '2');
  108.             _row.lastChild.lastChild.appendChild(_tmp);
  109.             _row.appendChild(document.createElement('td'));
  110.             _row.lastChild.setAttribute('class', _class);
  111.             _row.lastChild.setAttribute('className', _class);
  112.             _row.lastChild.setAttribute('vAlign', 'top');
  113.             _row.lastChild.setAttribute('width', _widths[3]);
  114.             _row.lastChild.appendChild(document.createElement('font'));
  115.             _row.lastChild.lastChild.size = '1';
  116.             _row.lastChild.lastChild.appendChild(document.createTextNode(_fields[_f][4]));
  117.             _holder.firstChild.appendChild(_row);
  118.         }
  119.         var _submit = document.createElement('tr');
  120.         _submit.appendChild(document.createElement('td'));
  121.         _submit.lastChild.setAttribute('class', 'window' + (((_f+1) % 2 == 0)? '1' : '2'));
  122.         _submit.lastChild.setAttribute('className', 'window' + (((_f+1) % 2 == 0)? '1' : '2'));
  123.         _submit.lastChild.setAttribute('align', 'center');
  124.         _submit.lastChild.setAttribute('colSpan', 3);
  125.         var _button = document.createElement('input');
  126.         _button.setAttribute('type', 'button');
  127.         _button.setAttribute('value', 'Post Message');
  128.         _button.onclick = function() { _posting_form.post_it(); };
  129.         _submit.lastChild.appendChild(_button);
  130.         _holder.firstChild.appendChild(_submit);
  131.         document.post_form.style.display = 'none';
  132.         document.post_form.parentNode.insertBefore(_holder,  document.post_form);
  133.     },
  134.     
  135.     post_it: function() {
  136.         // create message and attempt to post it
  137.         this.errors = new Array();
  138.         document.post_form.message.value = document.post_form.subject.value = '';
  139.         var _sub = document.getElementById('0').value;
  140.         _fields[0][5] = true;
  141.         document.post_form.subject.value    = _sub;
  142.         for(_f=0; _f<_fields.length; _f++) {
  143.             if(document.getElementById(_f)) {
  144.                 _value = document.getElementById(_f).value;
  145.                 if(!_value || _value.match(/^s*$/)) {
  146.                     if(_f > 0 && _fields[_f][5])
  147.                         this.show_error('You have left the ' + _fields[_f][1] + ' option empty. This is a required field and as such must contain a value.');
  148.                     else
  149.                         _value = '[i]None[/i]';
  150.                 }
  151.                 document.post_form.message.value += '[b]' + _fields[_f][1] + ':[/b] ' + _value + '\n\n';
  152.             }
  153.         }
  154.         if(this.errors.length == 0)
  155.             document.post_form.post.click();
  156.         else
  157.             this.show_error();
  158.     },
  159.     
  160.     show_error: function() {
  161.         if("undefined" != typeof arguments[0] && arguments[0]) {
  162.             this.errors.push(arguments[0]);
  163.         } else {
  164.             // Show Errors
  165.             if(document.getElementById('status_holder')) {
  166.                 document.getElementById('status_holder_title').innerHTML = "An Error Has Occured";
  167.                 document.getElementById('status_holder_message').innerHTML = this.errors.join("<br />");
  168.                 document.getElementById('status_holder').style.display = 'block';
  169.             }
  170.         }
  171.     }
  172. }
  173.  
  174.  
  175.  
  176. if(document.post_form && location.href.match(/action\/post\/?$/) && vf_username != 'Guest') {
  177.     _posting_form.init();
  178. }
  179. //-->
  180. </script>
 


Thanks
~Darkmage

Re: Predefined Posting Template/Form - Posted By Ross (admin) on 27th Dec 07 at 12:53am
I've modified the code in your post if you want to recopy from there. You were missing an apostrophe.

Re: Predefined Posting Template/Form - Posted By Nick (nickb) on 27th Dec 07 at 12:59am
Ok thanks lol ^_^

Re: Predefined Posting Template/Form - Posted By gray929 (gray929) on 6th Jan 08 at 8:30pm
Excellent code. Just what I needed.

Re: Predefined Posting Template/Form - Posted By gray929 (gray929) on 10th Jan 08 at 2:24am
Question about the dropdown box. When I added this:

Code:
 
  1. _fields[_f++] = new Array('select', 'Field Name, ie. "Gender" or "Type"', [], ['All Pages', 'Main Page', 'Mini-Profile', 'Info Center', 'Private Messaging', 'Profile', 'Posting', 'Thread Listing', 'Welcome Table', 'Other'], 'A short description of what the field is for.', true);
 


The options I wanted in the dropdown all went into the text field. All I did was change the names above. Am I missing a step?

Re: Predefined Posting Template/Form - Posted By Marc (cr0w) on 10th Jan 08 at 2:57am
Can you post a link, please? {Smile}

Re: Predefined Posting Template/Form - Posted By gray929 (gray929) on 10th Jan 08 at 11:18pm
 
Can you post a link, please? {Smile}


Link: http://www.gaming.virtualforums.co.uk

Screenshot:

Image

Re: Predefined Posting Template/Form - Posted By Michael (wrighty) on 10th Jan 08 at 11:28pm
could you PM me your editted version of the code so that I can test it on a test board please? {Smile}

Re: Predefined Posting Template/Form - Posted By gray929 (gray929) on 10th Jan 08 at 11:30pm
 
could you PM me your editted version of the code so that I can test it on a test board please? {Smile}


No. It's too long.

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 = 'New Code Request';
  11.  
  12. var _description = 'Please ensure you have a read of the <a href="URL">Rules</a> before posting';
  13.  
  14. var _fields = new Array(); var _f = 0;
  15.     _fields[_f++] = new Array('input', 'Platform', ['size', 40, 'maxLength', 50], '', 'Xbox 360, Playstation 3, Nintendo Wii', false);
  16.     _fields[_f++] = new Array('Xbox Live', 'Field Name, ie. "Gender" or "Type"', [], ['All Pages', 'Main Page', 'Mini-Profile', 'Info Center', 'Private Messaging', 'Profile', 'Posting', 'Thread Listing', 'Welcome Table', 'Other'], 'What is the issue you are encountering?', true);
  17.     _fields[_f++] = new Array('input', 'Genre', ['size', 40, 'maxLength', 50], '', 'What Genre is your forum? IE: RPG, General, Coding ETC.', false);
  18.  
  19. var _widths = ['100%', '20%', '40%', '40%'];
  20.  
  21. var _posting_form = {
  22.  
  23.     errors: new Array(),
  24.  
  25.     init: function() {
  26.         this.create_form();
  27.     },
  28.     
  29.     create_form: function() {
  30.         // Create new post layout
  31.         var _holder = document.createElement('table');
  32.         _holder.setAttribute('className', 'border');
  33.         _holder.setAttribute('class', 'border');
  34.         _holder.setAttribute('cellSpacing','1');
  35.         _holder.setAttribute('cellPadding', '4');
  36.         _holder.setAttribute('align', 'center');
  37.         _holder.setAttribute('width', _widths[0]);
  38.         _holder.setAttribute('id', 'post_form_holder');
  39.         _holder.appendChild(document.createElement('tbody'));
  40.         _holder.firstChild.appendChild( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
  41.         _holder.firstChild.lastChild.lastChild.className = 'title1';
  42.         _holder.firstChild.lastChild.lastChild.colSpan = '3';
  43.         _holder.firstChild.lastChild.lastChild.lastChild.size = '2';
  44.         _holder.firstChild.lastChild.lastChild.lastChild.appendChild(document.createTextNode(_title));
  45.         if(_description) {
  46.             _holder.firstChild.appendChild( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
  47.             _holder.firstChild.lastChild.lastChild.setAttribute('className', 'window1');
  48.             _holder.firstChild.lastChild.lastChild.setAttribute('class', 'window1');
  49.             _holder.firstChild.lastChild.lastChild.setAttribute('colSpan', '3');
  50.             _holder.firstChild.lastChild.lastChild.lastChild.setAttribute('size', '2');
  51.             _holder.firstChild.lastChild.lastChild.lastChild.innerHTML = _description;
  52.         }
  53.         
  54.         for(_f=0; _f<_fields.length; _f++) {
  55.             switch(_fields[_f][0]) {
  56.                 case 'textarea' :
  57.                     var _tmp = document.createElement('textarea');
  58.                 break;
  59.                 
  60.                 case 'select' :
  61.                     var _tmp = document.createElement('select');
  62.                     for(_o=0; _o<_fields[_f][3].length; _o++) {
  63.                         _tmp.options[_o] = new Option(_fields[_f][3][_o], _fields[_f][3][_o]);
  64.                     }
  65.                 break;
  66.                 
  67.                 default :
  68.                     var _tmp = document.createElement('input');
  69.                     _tmp.type = 'text';
  70.                     if("undefined" != typeof _fields[_f][3] && _fields[_f][3] != "")
  71.                         _tmp.setAttribute('value', _fields[_f][3]);
  72.                 break;
  73.             }
  74.             _tmp.setAttribute('id', _f);
  75.             if("undefined" != typeof _fields[_f][2] && _fields[_f][2].length > 0) {
  76.                 for(_a=0; _a<_fields[_f][2].length; _a++) {
  77.                     _tmp.setAttribute(_fields[_f][2][_a++], _fields[_f][2][_a]);
  78.                 }
  79.             }
  80.             var _class = 'window' + ((_f % 2 == 0)? '2' : '1');
  81.             var _row = document.createElement('tr');
  82.             _row.appendChild(document.createElement('td'));
  83.             _row.lastChild.setAttribute('class', _class);
  84.             _row.lastChild.setAttribute('className', _class);
  85.             _row.lastChild.setAttribute('vAlign', 'top');
  86.             _row.lastChild.setAttribute('width', _widths[1]);
  87.             _row.lastChild.appendChild(document.createElement('font'));
  88.             _row.lastChild.lastChild.setAttribute('size', '2');
  89.             _row.lastChild.lastChild.style.fontWeight = 'bold';
  90.             _row.lastChild.lastChild.appendChild(document.createTextNode(_fields[_f][1] + ':'));
  91.             _row.appendChild(document.createElement('td'));
  92.             _row.lastChild.setAttribute('class', _class);
  93.             _row.lastChild.setAttribute('className', _class);
  94.             _row.lastChild.setAttribute('width', _widths[2]);
  95.             _row.lastChild.appendChild(document.createElement('font'));
  96.             _row.lastChild.lastChild.setAttribute('size', '2');
  97.             _row.lastChild.lastChild.appendChild(_tmp);
  98.             _row.appendChild(document.createElement('td'));
  99.             _row.lastChild.setAttribute('class', _class);
  100.             _row.lastChild.setAttribute('className', _class);
  101.             _row.lastChild.setAttribute('vAlign', 'top');
  102.             _row.lastChild.setAttribute('width', _widths[3]);
  103.             _row.lastChild.appendChild(document.createElement('font'));
  104.             _row.lastChild.lastChild.size = '1';
  105.             _row.lastChild.lastChild.appendChild(document.createTextNode(_fields[_f][4]));
  106.             _holder.firstChild.appendChild(_row);
  107.         }
  108.         var _submit = document.createElement('tr');
  109.         _submit.appendChild(document.createElement('td'));
  110.         _submit.lastChild.setAttribute('class', 'window' + (((_f+1) % 2 == 0)? '1' : '2'));
  111.         _submit.lastChild.setAttribute('className', 'window' + (((_f+1) % 2 == 0)? '1' : '2'));
  112.         _submit.lastChild.setAttribute('align', 'center');
  113.         _submit.lastChild.setAttribute('colSpan', 3);
  114.         var _button = document.createElement('input');
  115.         _button.setAttribute('type', 'button');
  116.         _button.setAttribute('value', 'Post Message');
  117.         _button.onclick = function() { _posting_form.post_it(); };
  118.         _submit.lastChild.appendChild(_button);
  119.         _holder.firstChild.appendChild(_submit);
  120.         document.post_form.style.display = 'none';
  121.         document.post_form.parentNode.insertBefore(_holder,  document.post_form);
  122.     },
  123.     
  124.     post_it: function() {
  125.         // create message and attempt to post it
  126.         this.errors = new Array();
  127.         document.post_form.message.value = document.post_form.subject.value = '';
  128.         var _sub = document.getElementById('0').value;
  129.         _fields[0][5] = true;
  130.         document.post_form.subject.value    = _sub;
  131.         for(_f=0; _f<_fields.length; _f++) {
  132.             if(document.getElementById(_f)) {
  133.                 _value = document.getElementById(_f).value;
  134.                 if(!_value || _value.match(/^s*$/)) {
  135.                     if(_f > 0 && _fields[_f][5])
  136.                         this.show_error('You have left the ' + _fields[_f][1] + ' option empty. This is a required field and as such must contain a value.');
  137.                     else
  138.                         _value = '[i]None[/i]';
  139.                 }
  140.                 document.post_form.message.value += '[b]' + _fields[_f][1] + ':[/b] ' + _value + '\n\n';
  141.             }
  142.         }
  143.         if(this.errors.length == 0)
  144.             document.post_form.post.click();
  145.         else
  146.             this.show_error();
  147.     },
  148.     
  149.     show_error: function() {
  150.         if("undefined" != typeof arguments[0] && arguments[0]) {
  151.             this.errors.push(arguments[0]);
  152.         } else {
  153.             // Show Errors
  154.             if(document.getElementById('status_holder')) {
  155.                 document.getElementById('status_holder_title').innerHTML = "An Error Has Occured";
  156.                 document.getElementById('status_holder_message').innerHTML = this.errors.join("<br />");
  157.                 document.getElementById('status_holder').style.display = 'block';
  158.             }
  159.         }
  160.     }
  161. }
  162.  
  163.  
  164. if(document.post_form && location.href.match(/action\/post\/?$/) && vf_username != 'Guest') {
  165.     _posting_form.init();
  166. }
  167.  
  168. //-->
  169. </script>
 

Re: Predefined Posting Template/Form - Posted By Michael (wrighty) on 10th Jan 08 at 11:34pm
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 = 'New Code Request';
  11.  
  12. var _description = 'Please ensure you have a read of the <a href="URL">Rules</a> before posting';
  13.  
  14. var _fields = new Array(); var _f = 0;
  15.     _fields[_f++] = new Array('input', 'Platform', ['size', 40, 'maxLength', 50], '', 'Xbox 360, Playstation 3, Nintendo Wii', false);
  16.     _fields[_f++] = new Array('select', 'Field Name, ie. "Gender" or "Type"', [], ['All Pages', 'Main Page', 'Mini-Profile', 'Info Center', 'Private Messaging', 'Profile', 'Posting', 'Thread Listing', 'Welcome Table', 'Other'], 'What is the issue you are encountering?', true);
  17.     _fields[_f++] = new Array('input', 'Genre', ['size', 40, 'maxLength', 50], '', 'What Genre is your forum? IE: RPG, General, Coding ETC.', false);
  18.  
  19. var _widths = ['100%', '20%', '40%', '40%'];
  20.  
  21. var _posting_form = {
  22.  
  23.     errors: new Array(),
  24.  
  25.     init: function() {
  26.         this.create_form();
  27.     },
  28.     
  29.     create_form: function() {
  30.         // Create new post layout
  31.         var _holder = document.createElement('table');
  32.         _holder.setAttribute('className', 'border');
  33.         _holder.setAttribute('class', 'border');
  34.         _holder.setAttribute('cellSpacing','1');
  35.         _holder.setAttribute('cellPadding', '4');
  36.         _holder.setAttribute('align', 'center');
  37.         _holder.setAttribute('width', _widths[0]);
  38.         _holder.setAttribute('id', 'post_form_holder');
  39.         _holder.appendChild(document.createElement('tbody'));
  40.         _holder.firstChild.appendChild( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
  41.         _holder.firstChild.lastChild.lastChild.className = 'title1';
  42.         _holder.firstChild.lastChild.lastChild.colSpan = '3';
  43.         _holder.firstChild.lastChild.lastChild.lastChild.size = '2';
  44.         _holder.firstChild.lastChild.lastChild.lastChild.appendChild(document.createTextNode(_title));
  45.         if(_description) {
  46.             _holder.firstChild.appendChild( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
  47.             _holder.firstChild.lastChild.lastChild.setAttribute('className', 'window1');
  48.             _holder.firstChild.lastChild.lastChild.setAttribute('class', 'window1');
  49.             _holder.firstChild.lastChild.lastChild.setAttribute('colSpan', '3');
  50.             _holder.firstChild.lastChild.lastChild.lastChild.setAttribute('size', '2');
  51.             _holder.firstChild.lastChild.lastChild.lastChild.innerHTML = _description;
  52.         }
  53.         
  54.         for(_f=0; _f<_fields.length; _f++) {
  55.             switch(_fields[_f][0]) {
  56.                 case 'textarea' :
  57.                     var _tmp = document.createElement('textarea');
  58.                 break;
  59.                 
  60.                 case 'select' :
  61.                     var _tmp = document.createElement('select');
  62.                     for(_o=0; _o<_fields[_f][3].length; _o++) {
  63.                         _tmp.options[_o] = new Option(_fields[_f][3][_o], _fields[_f][3][_o]);
  64.                     }
  65.                 break;
  66.                 
  67.                 default :
  68.                     var _tmp = document.createElement('input');
  69.                     _tmp.type = 'text';
  70.                     if("undefined" != typeof _fields[_f][3] && _fields[_f][3] != "")
  71.                         _tmp.setAttribute('value', _fields[_f][3]);
  72.                 break;
  73.             }
  74.             _tmp.setAttribute('id', _f);
  75.             if("undefined" != typeof _fields[_f][2] && _fields[_f][2].length > 0) {
  76.                 for(_a=0; _a<_fields[_f][2].length; _a++) {
  77.                     _tmp.setAttribute(_fields[_f][2][_a++], _fields[_f][2][_a]);
  78.                 }
  79.             }
  80.             var _class = 'window' + ((_f % 2 == 0)? '2' : '1');
  81.             var _row = document.createElement('tr');
  82.             _row.appendChild(document.createElement('td'));
  83.             _row.lastChild.setAttribute('class', _class);
  84.             _row.lastChild.setAttribute('className', _class);
  85.             _row.lastChild.setAttribute('vAlign', 'top');
  86.             _row.lastChild.setAttribute('width', _widths[1]);
  87.             _row.lastChild.appendChild(document.createElement('font'));
  88.             _row.lastChild.lastChild.setAttribute('size', '2');
  89.             _row.lastChild.lastChild.style.fontWeight = 'bold';
  90.             _row.lastChild.lastChild.appendChild(document.createTextNode(_fields[_f][1] + ':'));
  91.             _row.appendChild(document.createElement('td'));
  92.             _row.lastChild.setAttribute('class', _class);
  93.             _row.lastChild.setAttribute('className', _class);
  94.             _row.lastChild.setAttribute('width', _widths[2]);
  95.             _row.lastChild.appendChild(document.createElement('font'));
  96.             _row.lastChild.lastChild.setAttribute('size', '2');
  97.             _row.lastChild.lastChild.appendChild(_tmp);
  98.             _row.appendChild(document.createElement('td'));
  99.             _row.lastChild.setAttribute('class', _class);
  100.             _row.lastChild.setAttribute('className', _class);
  101.             _row.lastChild.setAttribute('vAlign', 'top');
  102.             _row.lastChild.setAttribute('width', _widths[3]);
  103.             _row.lastChild.appendChild(document.createElement('font'));
  104.             _row.lastChild.lastChild.size = '1';
  105.             _row.lastChild.lastChild.appendChild(document.createTextNode(_fields[_f][4]));
  106.             _holder.firstChild.appendChild(_row);
  107.         }
  108.         var _submit = document.createElement('tr');
  109.         _submit.appendChild(document.createElement('td'));
  110.         _submit.lastChild.setAttribute('class', 'window' + (((_f+1) % 2 == 0)? '1' : '2'));
  111.         _submit.lastChild.setAttribute('className', 'window' + (((_f+1) % 2 == 0)? '1' : '2'));
  112.         _submit.lastChild.setAttribute('align', 'center');
  113.         _submit.lastChild.setAttribute('colSpan', 3);
  114.         var _button = document.createElement('input');
  115.         _button.setAttribute('type', 'button');
  116.         _button.setAttribute('value', 'Post Message');
  117.         _button.onclick = function() { _posting_form.post_it(); };
  118.         _submit.lastChild.appendChild(_button);
  119.         _holder.firstChild.appendChild(_submit);
  120.         document.post_form.style.display = 'none';
  121.         document.post_form.parentNode.insertBefore(_holder,  document.post_form);
  122.     },
  123.     
  124.     post_it: function() {
  125.         // create message and attempt to post it
  126.         this.errors = new Array();
  127.         document.post_form.message.value = document.post_form.subject.value = '';
  128.         var _sub = document.getElementById('0').value;
  129.         _fields[0][5] = true;
  130.         document.post_form.subject.value    = _sub;
  131.         for(_f=0; _f<_fields.length; _f++) {
  132.             if(document.getElementById(_f)) {
  133.                 _value = document.getElementById(_f).value;
  134.                 if(!_value || _value.match(/^s*$/)) {
  135.                     if(_f > 0 && _fields[_f][5])
  136.                         this.show_error('You have left the ' + _fields[_f][1] + ' option empty. This is a required field and as such must contain a value.');
  137.                     else
  138.                         _value = '[i]None[/i]';
  139.                 }
  140.                 document.post_form.message.value += '[b]' + _fields[_f][1] + ':[/b] ' + _value + '\n\n';
  141.             }
  142.         }
  143.         if(this.errors.length == 0)
  144.             document.post_form.post.click();
  145.         else
  146.             this.show_error();
  147.     },
  148.     
  149.     show_error: function() {
  150.         if("undefined" != typeof arguments[0] && arguments[0]) {
  151.             this.errors.push(arguments[0]);
  152.         } else {
  153.             // Show Errors
  154.             if(document.getElementById('status_holder')) {
  155.                 document.getElementById('status_holder_title').innerHTML = "An Error Has Occured";
  156.                 document.getElementById('status_holder_message').innerHTML = this.errors.join("<br />");
  157.                 document.getElementById('status_holder').style.display = 'block';
  158.             }
  159.         }
  160.     }
  161. }
  162.  
  163.  
  164. if(document.post_form && location.href.match(/action\/post\/?$/) && vf_username != 'Guest') {
  165.     _posting_form.init();
  166. }
  167.  
  168. //-->
  169. </script>
 


Try that! {Smile}

Works for me on a test board! {Grin}

Re: Predefined Posting Template/Form - Posted By gray929 (gray929) on 10th Jan 08 at 11:40pm
Works now. Thanks Wrighty. What did you do? {Cool}

Re: Predefined Posting Template/Form - Posted By Michael (wrighty) on 10th Jan 08 at 11:41pm
you had the field type set to: "Xbox Live" Strange... so just changed it to 'select'! {Smile}

Re: Predefined Posting Template/Form - Posted By gray929 (gray929) on 11th Jan 08 at 12:11am
 
you had the field type set to: "Xbox Live" Strange... so just changed it to 'select'! {Smile}


Must have gotten caught up with all the variables.

Is there a way to make it so if a user selects an option, for instance "Other" a text field will show up?

Re: Predefined Posting Template/Form - Posted By Michael (wrighty) on 11th Jan 08 at 12:50am
I am not prepared to go and modify Ross' code for that! {Sad}

Couldn't you just have the text field showing and have a description saying: "only fill if 'other' is selected"?

Re: Predefined Posting Template/Form - Posted By gray929 (gray929) on 11th Jan 08 at 2:19am
 
I am not prepared to go and modify Ross' code for that! {Sad}

Couldn't you just have the text field showing and have a description saying: "only fill if 'other' is selected"?


I wasn't asking you to, just wondering {Tongue Out} I guess I could do that. Thanks.

Re: Predefined Posting Template/Form - Posted By dog199200 (dog199200) on 23rd Jan 08 at 1:43am
Hey Ross just to let you know, you need to fix the original code in this post. It dont work...at first i thought that editing it made it not work, but then i tired the code with out editing and it still don't work...

Re: Predefined Posting Template/Form - Posted By Michael (wrighty) on 23rd Jan 08 at 2:14am
For now use the one I posted a couple of posts above your post.

it works fine. I'll point Ross here! {Smile}

Re: Predefined Posting Template/Form - Posted By dog199200 (dog199200) on 23rd Jan 08 at 2:29am
ok the one that Ross redid for that one guy works on my Inuyasha one, but then i tried it on my Naurto one and it didn't work...in fact none of them works on my naruto site...

http://narutoillusions.virtualforums.co.uk/

Re: Predefined Posting Template/Form - Posted By Michael (wrighty) on 23rd Jan 08 at 3:01am
try moving:

Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. /*
  4. Send PM's With No Subject by Cr0w
  5. Copyright 2008
  6. Do not repost
  7. */
  8.  
  9. var pForm = document.pm_form;
  10. pForm.onsubmit = function(){
  11. if(pForm.subject.value == "" || pForm.subject.value == null){
  12. var conf = confirm("PM has no subject!\nSend anyway?");
  13. if(conf){
  14. pForm.subject.value = "(no subject)";
  15. return true;
  16. }
  17. else{
  18. return false;
  19. }
  20. }
  21. }
  22. //-->
  23.  
  24. </script>
 


to your MAIN footer

Re: Predefined Posting Template/Form - Posted By dog199200 (dog199200) on 23rd Jan 08 at 3:20am
it is

Re: Predefined Posting Template/Form - Posted By Cryhavoc_ (virtuoso) on 5th Feb 08 at 2:01am
Oh Ross the great.

Re: Predefined Posting Template/Form - Posted By Tim (grievous) on 16th Mar 08 at 2:38am
Gee, thanks Ross for making this code so damn confusing.

So where exactly do we post the content of wat we want our members to fill out?

Re: Predefined Posting Template/Form - Posted By Marc (cr0w) on 16th Mar 08 at 2:45am
 
Gee, thanks Ross for making this code so damn confusing.

So where exactly do we post the content of wat we want our members to fill out?


Insulting code creators is never a good idea; they make these codes for you on their own time, not because they have to. {Unsure}

If you'd like help with a code, head on over to Code Support.

Re: Predefined Posting Template/Form - Posted By Tim (grievous) on 16th Mar 08 at 2:48am
I wasn't trying to insult him {Sad}

Re: Predefined Posting Template/Form - Posted By Dave (dave) on 15th Apr 09 at 10:08pm
This code no longer works and is returning an error {Smile}
 

Re: Predefined Posting Template/Form - Posted By Ross (admin) on 15th Apr 09 at 11:39pm
 
This code no longer works and is returning an error {Smile}
 

 
Looks like I hadn't followed my own advice and had left an un-escaped apostrophe in the example version. I have fixed the version in the first post {Smile}

Re: Predefined Posting Template/Form - Posted By Aiken (ionfortuna) on 7th Oct 09 at 8:17pm
In some of my boards the code is no longer working

Re: Predefined Posting Template/Form - Posted By Aiken (ionfortuna) on 18th Dec 09 at 3:37am
My Perfect World RP needs this code for multiple boards and it won't work on most of those boards

A suggestion: have a variable for post title or people can use default title method, also an optional variable for description

Re: Predefined Posting Template/Form - Posted By Nick (nickb) on 18th Dec 09 at 5:05am
Does the code have something like this: Don't if so then it would need something like this Don\'t in order for it to work.

But just in case, can you post the codes that don't work?

Re: Predefined Posting Template/Form - Posted By Aiken (ionfortuna) on 18th Dec 09 at 1:20pm
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 = 'Buying a room';
  11.  
  12. var _description = 'Please fill out these fields to buy your room, it costs 1 gold and 5 silver.';
  13.  
  14. var _fields = new Array(); var _f = 0;
  15.     _fields[_f++] = new Array('input', 'Room Name', ['size', 40, 'maxLength', 50], 'New room', '', true);
  16.     _fields[_f++] = new Array('select', 'Location of Room', [], ['Perfect World', '--Portal of Darkness', '--Paradise', '----Kami's battle house', '----Fantasia'], '', true);
  17.     _fields[_f++] = new Array('textarea', 'Brief Description', ['cols', 40, 'rows', 10, 'maxlength', 300], '', '300 characters max', true);
  18.     _fields[_f++] = new Array('textarea', 'Full Description', ['cols', 40, 'rows', 10], '', 'Unlimited characters - optional', false);
  19.  
  20. var _widths = ['100%'];
  21.  
  22. var _posting_form = {
  23.  
  24.     errors: new Array(),
  25.  
  26.     init: function() {
  27.         this.create_form();
  28.     },
  29.     
  30.     create_form: function() {
  31.         // Create new post layout
  32.         var _holder = document.createElement('table');
  33.         _holder.setAttribute('className', 'border');
  34.         _holder.setAttribute('class', 'border');
  35.         _holder.setAttribute('cellSpacing','1');
  36.         _holder.setAttribute('cellPadding', '4');
  37.         _holder.setAttribute('align', 'center');
  38.         _holder.setAttribute('width', _widths[0]);
  39.         _holder.setAttribute('id', 'post_form_holder');
  40.         _holder.appendChild(document.createElement('tbody'));
  41.         _holder.firstChild.appendChild( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
  42.         _holder.firstChild.lastChild.lastChild.className = 'title1';
  43.         _holder.firstChild.lastChild.lastChild.colSpan = '3';
  44.         _holder.firstChild.lastChild.lastChild.lastChild.size = '2';
  45.         _holder.firstChild.lastChild.lastChild.lastChild.appendChild(document.createTextNode(_title));
  46.         if(_description) {
  47.             _holder.firstChild.appendChild( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
  48.             _holder.firstChild.lastChild.lastChild.setAttribute('className', 'window1');
  49.             _holder.firstChild.lastChild.lastChild.setAttribute('class', 'window1');
  50.             _holder.firstChild.lastChild.lastChild.setAttribute('colSpan', '3');
  51.             _holder.firstChild.lastChild.lastChild.lastChild.setAttribute('size', '2');
  52.             _holder.firstChild.lastChild.lastChild.lastChild.innerHTML = _description;
  53.         }
  54.         
  55.         for(_f=0; _f<_fields.length; _f++) {
  56.             switch(_fields[_f][0]) {
  57.                 case 'textarea' :
  58.                     var _tmp = document.createElement('textarea');
  59.                 break;
  60.                 
  61.                 case 'select' :
  62.                     var _tmp = document.createElement('select');
  63.                     for(_o=0; _o<_fields[_f][3].length; _o++) {
  64.                         _tmp.options[_o] = new Option(_fields[_f][3][_o], _fields[_f][3][_o]);
  65.                     }
  66.                 break;
  67.                 
  68.                 default :
  69.                     var _tmp = document.createElement('input');
  70.                     _tmp.type = 'text';
  71.                     if("undefined" != typeof _fields[_f][3] && _fields[_f][3] != "")
  72.                         _tmp.setAttribute('value', _fields[_f][3]);
  73.                 break;
  74.             }
  75.             _tmp.setAttribute('id', _f);
  76.             if("undefined" != typeof _fields[_f][2] && _fields[_f][2].length > 0) {
  77.                 for(_a=0; _a<_fields[_f][2].length; _a++) {
  78.                     _tmp.setAttribute(_fields[_f][2][_a++], _fields[_f][2][_a]);
  79.                 }
  80.             }
  81.             var _class = 'window' + ((_f % 2 == 0)? '2' : '1');
  82.             var _row = document.createElement('tr');
  83.             _row.appendChild(document.createElement('td'));
  84.             _row.lastChild.setAttribute('class', _class);
  85.             _row.lastChild.setAttribute('className', _class);
  86.             _row.lastChild.setAttribute('vAlign', 'top');
  87.             _row.lastChild.setAttribute('width', _widths[1]);
  88.             _row.lastChild.appendChild(document.createElement('font'));
  89.             _row.lastChild.lastChild.setAttribute('size', '2');
  90.             _row.lastChild.lastChild.style.fontWeight = 'bold';
  91.             _row.lastChild.lastChild.appendChild(document.createTextNode(_fields[_f][1] + ':'));
  92.             _row.appendChild(document.createElement('td'));
  93.             _row.lastChild.setAttribute('class', _class);
  94.             _row.lastChild.setAttribute('className', _class);
  95.             _row.lastChild.setAttribute('width', _widths[2]);
  96.             _row.lastChild.appendChild(document.createElement('font'));
  97.             _row.lastChild.lastChild.setAttribute('size', '2');
  98.             _row.lastChild.lastChild.appendChild(_tmp);
  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[3]);
  104.             _row.lastChild.appendChild(document.createElement('font'));
  105.             _row.lastChild.lastChild.size = '1';
  106.             _row.lastChild.lastChild.appendChild(document.createTextNode(_fields[_f][4]));
  107.             _holder.firstChild.appendChild(_row);
  108.         }
  109.         var _submit = document.createElement('tr');
  110.         _submit.appendChild(document.createElement('td'));
  111.         _submit.lastChild.setAttribute('class', 'window' + (((_f+1) % 2 == 0)? '1' : '2'));
  112.         _submit.lastChild.setAttribute('className', 'window' + (((_f+1) % 2 == 0)? '1' : '2'));
  113.         _submit.lastChild.setAttribute('align', 'center');
  114.         _submit.lastChild.setAttribute('colSpan', 3);
  115.         var _button = document.createElement('input');
  116.         _button.setAttribute('type', 'button');
  117.         _button.setAttribute('value', 'Post Message');
  118.         _button.onclick = function() { _posting_form.post_it(); };
  119.         _submit.lastChild.appendChild(_button);
  120.         _holder.firstChild.appendChild(_submit);
  121.         document.post_form.style.display = 'none';
  122.         document.post_form.parentNode.insertBefore(_holder,  document.post_form);
  123.     },
  124.     
  125.     post_it: function() {
  126.         // create message and attempt to post it
  127.         this.errors = new Array();
  128.         document.post_form.message.value = document.post_form.subject.value = '';
  129.         var _sub = document.getElementById('0').value;
  130.         _fields[0][5] = true;
  131.         document.post_form.subject.value    = _sub;
  132.         for(_f=0; _f<_fields.length; _f++) {
  133.             if(document.getElementById(_f)) {
  134.                 _value = document.getElementById(_f).value;
  135.                 if(!_value || _value.match(/^s*$/)) {
  136.                     if(_f > 0 && _fields[_f][5])
  137.                         this.show_error('You have left the ' + _fields[_f][1] + ' option empty. This is a required field and as such must contain a value.');
  138.                     else
  139.                         _value = '[i]None[/i]';
  140.                 }
  141.                 document.post_form.message.value += '[b]' + _fields[_f][1] + ':[/b] ' + _value + '
  142. ';
  143.             }
  144.         }
  145.         if(this.errors.length == 0)
  146.             document.post_form.post.click();
  147.         else
  148.             this.show_error();
  149.     },
  150.     
  151.     show_error: function() {
  152.         if("undefined" != typeof arguments[0] && arguments[0]) {
  153.             this.errors.push(arguments[0]);
  154.         } else {
  155.             // Show Errors
  156.             if(document.getElementById('status_holder')) {
  157.                 document.getElementById('status_holder_title').innerHTML = "An Error Has Occured";
  158.                 document.getElementById('status_holder_message').innerHTML = this.errors.join("<br />");
  159.                 document.getElementById('status_holder').style.display = 'block';
  160.             }
  161.         }
  162.     }
  163. }
  164.  
  165.  
  166. if(document.post_form && location.href.match(/action\/post\/?$/) && vf_username != 'Guest') {
  167.     _posting_form.init();
  168. }
  169.  
  170. //-->
  171. </script><script type="text/javascript">
  172. <!--
  173.  
  174. /* Predefined Posting Template/Form
  175.     Created by Ross of vForums
  176.     http://virtualforums.co.uk
  177.     Please do not repost outside of
  178.     vForums support without permission */
  179.  
  180. var _title = 'Buying an item';
  181.  
  182. var _description = 'Please select what item you are buying<br><br>Colors: 5,000 Yen<br>Style: 1,000 Yen';
  183.  
  184. var _fields = new Array(); var _f = 0;
  185.     _fields[_f++] = new Array('select', 'Item', [], ['Red Name', 'Blue Name', 'Yellow Name', 'Green Name', 'Orange Name', 'Purple Name', 'White Name', 'Gold Name', 'Silver Name', 'Pink Name', 'Gray Name', 'Bold Name', 'Italic Name', 'Strike Through Name'], '', true);
  186.  
  187. var _widths = ['100%'];
  188.  
  189. var _posting_form = {
  190.  
  191.     errors: new Array(),
  192.  
  193.     init: function() {
  194.         this.create_form();
  195.     },
  196.     
  197.     create_form: function() {
  198.         // Create new post layout
  199.         var _holder = document.createElement('table');
  200.         _holder.setAttribute('className', 'border');
  201.         _holder.setAttribute('class', 'border');
  202.         _holder.setAttribute('cellSpacing','1');
  203.         _holder.setAttribute('cellPadding', '4');
  204.         _holder.setAttribute('align', 'center');
  205.         _holder.setAttribute('width', _widths[0]);
  206.         _holder.setAttribute('id', 'post_form_holder');
  207.         _holder.appendChild(document.createElement('tbody'));
  208.         _holder.firstChild.appendChild( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
  209.         _holder.firstChild.lastChild.lastChild.className = 'title1';
  210.         _holder.firstChild.lastChild.lastChild.colSpan = '3';
  211.         _holder.firstChild.lastChild.lastChild.lastChild.size = '2';
  212.         _holder.firstChild.lastChild.lastChild.lastChild.appendChild(document.createTextNode(_title));
  213.         if(_description) {
  214.             _holder.firstChild.appendChild( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
  215.             _holder.firstChild.lastChild.lastChild.setAttribute('className', 'window1');
  216.             _holder.firstChild.lastChild.lastChild.setAttribute('class', 'window1');
  217.             _holder.firstChild.lastChild.lastChild.setAttribute('colSpan', '3');
  218.             _holder.firstChild.lastChild.lastChild.lastChild.setAttribute('size', '2');
  219.             _holder.firstChild.lastChild.lastChild.lastChild.innerHTML = _description;
  220.         }
  221.         
  222.         for(_f=0; _f<_fields.length; _f++) {
  223.             switch(_fields[_f][0]) {
  224.                 case 'textarea' :
  225.                     var _tmp = document.createElement('textarea');
  226.                 break;
  227.                 
  228.                 case 'select' :
  229.                     var _tmp = document.createElement('select');
  230.                     for(_o=0; _o<_fields[_f][3].length; _o++) {
  231.                         _tmp.options[_o] = new Option(_fields[_f][3][_o], _fields[_f][3][_o]);
  232.                     }
  233.                 break;
  234.                 
  235.                 default :
  236.                     var _tmp = document.createElement('input');
  237.                     _tmp.type = 'text';
  238.                     if("undefined" != typeof _fields[_f][3] && _fields[_f][3] != "")
  239.                         _tmp.setAttribute('value', _fields[_f][3]);
  240.                 break;
  241.             }
  242.             _tmp.setAttribute('id', _f);
  243.             if("undefined" != typeof _fields[_f][2] && _fields[_f][2].length > 0) {
  244.                 for(_a=0; _a<_fields[_f][2].length; _a++) {
  245.                     _tmp.setAttribute(_fields[_f][2][_a++], _fields[_f][2][_a]);
  246.                 }
  247.             }
  248.             var _class = 'window' + ((_f % 2 == 0)? '2' : '1');
  249.             var _row = document.createElement('tr');
  250.             _row.appendChild(document.createElement('td'));
  251.             _row.lastChild.setAttribute('class', _class);
  252.             _row.lastChild.setAttribute('className', _class);
  253.             _row.lastChild.setAttribute('vAlign', 'top');
  254.             _row.lastChild.setAttribute('width', _widths[1]);
  255.             _row.lastChild.appendChild(document.createElement('font'));
  256.             _row.lastChild.lastChild.setAttribute('size', '2');
  257.             _row.lastChild.lastChild.style.fontWeight = 'bold';
  258.             _row.lastChild.lastChild.appendChild(document.createTextNode(_fields[_f][1] + ':'));
  259.             _row.appendChild(document.createElement('td'));
  260.             _row.lastChild.setAttribute('class', _class);
  261.             _row.lastChild.setAttribute('className', _class);
  262.             _row.lastChild.setAttribute('width', _widths[2]);
  263.             _row.lastChild.appendChild(document.createElement('font'));
  264.             _row.lastChild.lastChild.setAttribute('size', '2');
  265.             _row.lastChild.lastChild.appendChild(_tmp);
  266.             _row.appendChild(document.createElement('td'));
  267.             _row.lastChild.setAttribute('class', _class);
  268.             _row.lastChild.setAttribute('className', _class);
  269.             _row.lastChild.setAttribute('vAlign', 'top');
  270.             _row.lastChild.setAttribute('width', _widths[3]);
  271.             _row.lastChild.appendChild(document.createElement('font'));
  272.             _row.lastChild.lastChild.size = '1';
  273.             _row.lastChild.lastChild.appendChild(document.createTextNode(_fields[_f][4]));
  274.             _holder.firstChild.appendChild(_row);
  275.         }
  276.         var _submit = document.createElement('tr');
  277.         _submit.appendChild(document.createElement('td'));
  278.         _submit.lastChild.setAttribute('class', 'window' + (((_f+1) % 2 == 0)? '1' : '2'));
  279.         _submit.lastChild.setAttribute('className', 'window' + (((_f+1) % 2 == 0)? '1' : '2'));
  280.         _submit.lastChild.setAttribute('align', 'center');
  281.         _submit.lastChild.setAttribute('colSpan', 3);
  282.         var _button = document.createElement('input');
  283.         _button.setAttribute('type', 'button');
  284.         _button.setAttribute('value', 'Post Message');
  285.         _button.onclick = function() { _posting_form.post_it(); };
  286.         _submit.lastChild.appendChild(_button);
  287.         _holder.firstChild.appendChild(_submit);
  288.         document.post_form.style.display = 'none';
  289.         document.post_form.parentNode.insertBefore(_holder,  document.post_form);
  290.     },
  291.     
  292.     post_it: function() {
  293.         // create message and attempt to post it
  294.         this.errors = new Array();
  295.         document.post_form.message.value = document.post_form.subject.value = '';
  296.         var _sub = document.getElementById('0').value;
  297.         _fields[0][5] = true;
  298.         document.post_form.subject.value    = _sub;
  299.         for(_f=0; _f<_fields.length; _f++) {
  300.             if(document.getElementById(_f)) {
  301.                 _value = document.getElementById(_f).value;
  302.                 if(!_value || _value.match(/^s*$/)) {
  303.                     if(_f > 0 && _fields[_f][5])
  304.                         this.show_error('You have left the ' + _fields[_f][1] + ' option empty. This is a required field and as such must contain a value.');
  305.                     else
  306.                         _value = '[i]None[/i]';
  307.                 }
  308.                 document.post_form.message.value += '[b]' + _fields[_f][1] + ':[/b] ' + _value + '
  309. ';
  310.             }
  311.         }
  312.         if(this.errors.length == 0)
  313.             document.post_form.post.click();
  314.         else
  315.             this.show_error();
  316.     },
  317.     
  318.     show_error: function() {
  319.         if("undefined" != typeof arguments[0] && arguments[0]) {
  320.             this.errors.push(arguments[0]);
  321.         } else {
  322.             // Show Errors
  323.             if(document.getElementById('status_holder')) {
  324.                 document.getElementById('status_holder_title').innerHTML = "An Error Has Occured";
  325.                 document.getElementById('status_holder_message').innerHTML = this.errors.join("<br />");
  326.                 document.getElementById('status_holder').style.display = 'block';
  327.             }
  328.         }
  329.     }
  330. }
  331.  
  332.  
  333. if(document.post_form && location.href.match(/action\/post\/?$/) && vf_username != 'Guest') {
  334.     _posting_form.init();
  335. }
  336.  
  337. //-->
  338. </script>
 

Re: Predefined Posting Template/Form - Posted By Aiken (ionfortuna) on 18th Dec 09 at 1:20pm
duplicate post, please ignore -- ashkir

Re: Predefined Posting Template/Form - Posted By Nick (nickb) on 18th Dec 09 at 8:26pm
Ok your Room code works perfectly now and I will get on the second one. Don't change anything within the code, as it may mess it up again.

Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. /* Predefined Posting Template/Form
  4.     Created by Ross of vForums
  5.     http://virtualforums.co.uk
  6.     Please do not repost outside of
  7.     vForums support without permission */
  8. var _title = 'Buying a room';
  9. var _description = 'Please fill out these fields to buy your room, it costs 1 gold and 5 silver.';
  10. var _fields = new Array(); var _f = 0;
  11.   
  12.     _fields[_f++] = new Array('input', 'Room Name', ['size', 40, 'maxLength', 50], 'New room', '', true);
  13.     _fields[_f++] = new Array('select', 'Location of Room', false, ['Perfect World', '--Portal of Darkness', '--Paradise', '----Kami\'s battle house', '----Fantasia'], '..', true);
  14.     _fields[_f++] = new Array('textarea', 'Brief Description', ['cols', 40, 'rows', 10, 'maxlength', 300], '', '300 characters max', true);
  15.     _fields[_f++] = new Array('textarea', 'Full Description', ['cols', 40, 'rows', 10], '', 'Unlimited characters - optional', false);
  16.  
  17.  
  18. var _widths = ['100%', '20%', '40%', '40%'];
  19. var _posting_form = {
  20.     errors: new Array(),
  21.     init: function() {
  22.         this.create_form();
  23.     },
  24.     
  25.     create_form: function() {
  26.         // Create new post layout
  27.         var _holder = document.createElement('table');
  28.         _holder.setAttribute('className', 'border');
  29.         _holder.setAttribute('class', 'border');
  30.         _holder.setAttribute('cellSpacing','1');
  31.         _holder.setAttribute('cellPadding', '4');
  32.         _holder.setAttribute('align', 'center');
  33.         _holder.setAttribute('width', _widths[0]);
  34.         _holder.setAttribute('id', 'post_form_holder');
  35.         _holder.appendChild(document.createElement('tbody'));
  36.         _holder.firstChild.appendChild( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
  37.         _holder.firstChild.lastChild.lastChild.className = 'title1';
  38.         _holder.firstChild.lastChild.lastChild.colSpan = '3';
  39.         _holder.firstChild.lastChild.lastChild.lastChild.size = '2';
  40.         _holder.firstChild.lastChild.lastChild.lastChild.appendChild(document.createTextNode(_title));
  41.         if(_description) {
  42.             _holder.firstChild.appendChild( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
  43.             _holder.firstChild.lastChild.lastChild.setAttribute('className', 'window1');
  44.             _holder.firstChild.lastChild.lastChild.setAttribute('class', 'window1');
  45.             _holder.firstChild.lastChild.lastChild.setAttribute('colSpan', '3');
  46.             _holder.firstChild.lastChild.lastChild.lastChild.setAttribute('size', '2');
  47.             _holder.firstChild.lastChild.lastChild.lastChild.innerHTML = _description;
  48.         }
  49.         
  50.         for(_f=0; _f<_fields.length; _f++) {
  51.             switch(_fields[_f][0]) {
  52.                 case 'textarea' :
  53.                     var _tmp = document.createElement('textarea');
  54.                 break;
  55.                 
  56.                 case 'select' :
  57.                     var _tmp = document.createElement('select');
  58.                     for(_o=0; _o<_fields[_f][3].length; _o++) {
  59.                         _tmp.options[_o] = new Option(_fields[_f][3][_o], _fields[_f][3][_o]);
  60.                     }
  61.                 break;
  62.                 
  63.                 default :
  64.                     var _tmp = document.createElement('input');
  65.                     _tmp.type = 'text';
  66.                     if("undefined" != typeof _fields[_f][3] && _fields[_f][3] != "")
  67.                         _tmp.setAttribute('value', _fields[_f][3]);
  68.                 break;
  69.             }
  70.             _tmp.setAttribute('id', _f);
  71.             if("undefined" != typeof _fields[_f][2] && _fields[_f][2].length > 0) {
  72.                 for(_a=0; _a<_fields[_f][2].length; _a++) {
  73.                     _tmp.setAttribute(_fields[_f][2][_a++], _fields[_f][2][_a]);
  74.                 }
  75.             }
  76.             var _class = 'window' + ((_f % 2 == 0)? '2' : '1');
  77.             var _row = document.createElement('tr');
  78.             _row.appendChild(document.createElement('td'));
  79.             _row.lastChild.setAttribute('class', _class);
  80.             _row.lastChild.setAttribute('className', _class);
  81.             _row.lastChild.setAttribute('vAlign', 'top');
  82.             _row.lastChild.setAttribute('width', _widths[1]);
  83.             _row.lastChild.appendChild(document.createElement('font'));
  84.             _row.lastChild.lastChild.setAttribute('size', '2');
  85.             _row.lastChild.lastChild.style.fontWeight = 'bold';
  86.             _row.lastChild.lastChild.appendChild(document.createTextNode(_fields[_f][1] + ':'));
  87.             _row.appendChild(document.createElement('td'));
  88.             _row.lastChild.setAttribute('class', _class);
  89.             _row.lastChild.setAttribute('className', _class);
  90.             _row.lastChild.setAttribute('width', _widths[2]);
  91.             _row.lastChild.appendChild(document.createElement('font'));
  92.             _row.lastChild.lastChild.setAttribute('size', '2');
  93.             _row.lastChild.lastChild.appendChild(_tmp);
  94.             _row.appendChild(document.createElement('td'));
  95.             _row.lastChild.setAttribute('class', _class);
  96.             _row.lastChild.setAttribute('className', _class);
  97.             _row.lastChild.setAttribute('vAlign', 'top');
  98.             _row.lastChild.setAttribute('width', _widths[3]);
  99.             _row.lastChild.appendChild(document.createElement('font'));
  100.             _row.lastChild.lastChild.size = '1';
  101.             _row.lastChild.lastChild.appendChild(document.createTextNode(_fields[_f][4]));
  102.             _holder.firstChild.appendChild(_row);
  103.         }
  104.         var _submit = document.createElement('tr');
  105.         _submit.appendChild(document.createElement('td'));
  106.         _submit.lastChild.setAttribute('class', 'window' + (((_f+1) % 2 == 0)? '1' : '2'));
  107.         _submit.lastChild.setAttribute('className', 'window' + (((_f+1) % 2 == 0)? '1' : '2'));
  108.         _submit.lastChild.setAttribute('align', 'center');
  109.         _submit.lastChild.setAttribute('colSpan', 3);
  110.         var _button = document.createElement('input');
  111.         _button.setAttribute('type', 'button');
  112.         _button.setAttribute('value', 'Post Message');
  113.         _button.onclick = function() { _posting_form.post_it(); };
  114.         _submit.lastChild.appendChild(_button);
  115.         _holder.firstChild.appendChild(_submit);
  116.         document.post_form.style.display = 'none';
  117.         document.post_form.parentNode.insertBefore(_holder,  document.post_form);
  118.     },
  119.     
  120.     post_it: function() {
  121.         // create message and attempt to post it
  122.         this.errors = new Array();
  123.         document.post_form.message.value = document.post_form.subject.value = '';
  124.         var _sub = document.getElementById('0').value;
  125.         _fields[0][5] = true;
  126.         document.post_form.subject.value    = _sub;
  127.         for(_f=0; _f<_fields.length; _f++) {
  128.             if(document.getElementById(_f)) {
  129.                 _value = document.getElementById(_f).value;
  130.                 if(!_value || _value.match(/^s*$/)) {
  131.                     if(_f > 0 && _fields[_f][5])
  132.                         this.show_error('You have left the ' + _fields[_f][1] + ' option empty. This is a required field and as such must contain a value.');
  133.                     else
  134.                         _value = 'None';
  135.                 }
  136.                 document.post_form.message.value += '' + _fields[_f][1] + ': ' + _value + 'nn';
  137.             }
  138.         }
  139.         if(this.errors.length == 0)
  140.             document.post_form.post.click();
  141.         else
  142.             this.show_error();
  143.     },
  144.     
  145.     show_error: function() {
  146.         if("undefined" != typeof arguments[0] && arguments[0]) {
  147.             this.errors.push(arguments[0]);
  148.         } else {
  149.             // Show Errors
  150.             if(document.getElementById('status_holder')) {
  151.                 document.getElementById('status_holder_title').innerHTML = "An Error Has Occured";
  152.                 document.getElementById('status_holder_message').innerHTML = this.errors.join("<br />");
  153.                 document.getElementById('status_holder').style.display = 'block';
  154.             }
  155.         }
  156.     }
  157. }
  158. if(document.post_form && location.href.match(/action\/post\/?$/) && vf_username != 'Guest') {
  159.     _posting_form.init();
  160. }
  161. //-->
  162. </script>
 


Re: Predefined Posting Template/Form - Posted By Aiken (ionfortuna) on 18th Dec 09 at 8:35pm
What about the other code? And the room code must be changed every time somebody makes a room:

Room
Room
-Sub-Room
--Sub-Sub-Room
-Sub-Room
Room

Re: Predefined Posting Template/Form - Posted By Nick (nickb) on 18th Dec 09 at 9:23pm
I've got the other code right here, and what do you mean?

Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. /* Predefined Posting Template/Form
  4.     Created by Ross of vForums
  5.     http://virtualforums.co.uk
  6.     Please do not repost outside of
  7.     vForums support without permission */
  8. var _title = 'Create a group';
  9. var _description = 'The cost to create a group is 50,000 Yen except for admin';
  10. var _fields = new Array(); var _f = 0;
  11.  
  12.     _fields[_f++] = new Array('input', 'Group Name', ['size', 40, 'maxLength', 20], '', ' ', true);
  13.     _fields[_f++] = new Array('input', 'Your Group Rank', ['size', 40, 'maxLength', 15], '', ' ', true);
  14.     _fields[_f++] = new Array('select', 'Your Group Rank Color', false, ['None', 'Red', 'Blue','Green','Orange','Purple','White','Pink','Gray','Gold','Silver'], '', true);
  15.     _fields[_f++] = new Array('input', 'Starting Group Rank', ['size', 40, 'maxLength', 15], false, 'Optional', false);
  16.     _fields[_f++] = new Array('select', 'Group Color', false, ['None', 'Red', 'Blue','Green','Orange','Purple','White','Pink','Gray','Gold','Silver'], '', true);
  17.     _fields[_f++] = new Array('textarea', 'Brief Description', ['cols', 40, 'rows', 5, 'maxlength', 300], false, '300 character max', true);
  18.     _fields[_f++] = new Array('textarea', 'Full Description', ['cols', 40, 'rows', 20], false, '', false);
  19.  
  20. var _widths = ['100%', '20%', '40%', '40%'];
  21. var _posting_form = {
  22.     errors: new Array(),
  23.     init: function() {
  24.         this.create_form();
  25.     },
  26.     
  27.     create_form: function() {
  28.         // Create new post layout
  29.         var _holder = document.createElement('table');
  30.         _holder.setAttribute('className', 'border');
  31.         _holder.setAttribute('class', 'border');
  32.         _holder.setAttribute('cellSpacing','1');
  33.         _holder.setAttribute('cellPadding', '4');
  34.         _holder.setAttribute('align', 'center');
  35.         _holder.setAttribute('width', _widths[0]);
  36.         _holder.setAttribute('id', 'post_form_holder');
  37.         _holder.appendChild(document.createElement('tbody'));
  38.         _holder.firstChild.appendChild( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
  39.         _holder.firstChild.lastChild.lastChild.className = 'title1';
  40.         _holder.firstChild.lastChild.lastChild.colSpan = '3';
  41.         _holder.firstChild.lastChild.lastChild.lastChild.size = '2';
  42.         _holder.firstChild.lastChild.lastChild.lastChild.appendChild(document.createTextNode(_title));
  43.         if(_description) {
  44.             _holder.firstChild.appendChild( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
  45.             _holder.firstChild.lastChild.lastChild.setAttribute('className', 'window1');
  46.             _holder.firstChild.lastChild.lastChild.setAttribute('class', 'window1');
  47.             _holder.firstChild.lastChild.lastChild.setAttribute('colSpan', '3');
  48.             _holder.firstChild.lastChild.lastChild.lastChild.setAttribute('size', '2');
  49.             _holder.firstChild.lastChild.lastChild.lastChild.innerHTML = _description;
  50.         }
  51.         
  52.         for(_f=0; _f<_fields.length; _f++) {
  53.             switch(_fields[_f][0]) {
  54.                 case 'textarea' :
  55.                     var _tmp = document.createElement('textarea');
  56.                 break;
  57.                 
  58.                 case 'select' :
  59.                     var _tmp = document.createElement('select');
  60.                     for(_o=0; _o<_fields[_f][3].length; _o++) {
  61.                         _tmp.options[_o] = new Option(_fields[_f][3][_o], _fields[_f][3][_o]);
  62.                     }
  63.                 break;
  64.                 
  65.                 default :
  66.                     var _tmp = document.createElement('input');
  67.                     _tmp.type = 'text';
  68.                     if("undefined" != typeof _fields[_f][3] && _fields[_f][3] != "")
  69.                         _tmp.setAttribute('value', _fields[_f][3]);
  70.                 break;
  71.             }
  72.             _tmp.setAttribute('id', _f);
  73.             if("undefined" != typeof _fields[_f][2] && _fields[_f][2].length > 0) {
  74.                 for(_a=0; _a<_fields[_f][2].length; _a++) {
  75.                     _tmp.setAttribute(_fields[_f][2][_a++], _fields[_f][2][_a]);
  76.                 }
  77.             }
  78.             var _class = 'window' + ((_f % 2 == 0)? '2' : '1');
  79.             var _row = document.createElement('tr');
  80.             _row.appendChild(document.createElement('td'));
  81.             _row.lastChild.setAttribute('class', _class);
  82.             _row.lastChild.setAttribute('className', _class);
  83.             _row.lastChild.setAttribute('vAlign', 'top');
  84.             _row.lastChild.setAttribute('width', _widths[1]);
  85.             _row.lastChild.appendChild(document.createElement('font'));
  86.             _row.lastChild.lastChild.setAttribute('size', '2');
  87.             _row.lastChild.lastChild.style.fontWeight = 'bold';
  88.             _row.lastChild.lastChild.appendChild(document.createTextNode(_fields[_f][1] + ':'));
  89.             _row.appendChild(document.createElement('td'));
  90.             _row.lastChild.setAttribute('class', _class);
  91.             _row.lastChild.setAttribute('className', _class);
  92.             _row.lastChild.setAttribute('width', _widths[2]);
  93.             _row.lastChild.appendChild(document.createElement('font'));
  94.             _row.lastChild.lastChild.setAttribute('size', '2');
  95.             _row.lastChild.lastChild.appendChild(_tmp);
  96.             _row.appendChild(document.createElement('td'));
  97.             _row.lastChild.setAttribute('class', _class);
  98.             _row.lastChild.setAttribute('className', _class);
  99.             _row.lastChild.setAttribute('vAlign', 'top');
  100.             _row.lastChild.setAttribute('width', _widths[3]);
  101.             _row.lastChild.appendChild(document.createElement('font'));
  102.             _row.lastChild.lastChild.size = '1';
  103.             _row.lastChild.lastChild.appendChild(document.createTextNode(_fields[_f][4]));
  104.             _holder.firstChild.appendChild(_row);
  105.         }
  106.         var _submit = document.createElement('tr');
  107.         _submit.appendChild(document.createElement('td'));
  108.         _submit.lastChild.setAttribute('class', 'window' + (((_f+1) % 2 == 0)? '1' : '2'));
  109.         _submit.lastChild.setAttribute('className', 'window' + (((_f+1) % 2 == 0)? '1' : '2'));
  110.         _submit.lastChild.setAttribute('align', 'center');
  111.         _submit.lastChild.setAttribute('colSpan', 3);
  112.         var _button = document.createElement('input');
  113.         _button.setAttribute('type', 'button');
  114.         _button.setAttribute('value', 'Post Message');
  115.         _button.onclick = function() { _posting_form.post_it(); };
  116.         _submit.lastChild.appendChild(_button);
  117.         _holder.firstChild.appendChild(_submit);
  118.         document.post_form.style.display = 'none';
  119.         document.post_form.parentNode.insertBefore(_holder,  document.post_form);
  120.     },
  121.     
  122.     post_it: function() {
  123.         // create message and attempt to post it
  124.         this.errors = new Array();
  125.         document.post_form.message.value = document.post_form.subject.value = '';
  126.         var _sub = document.getElementById('0').value;
  127.         _fields[0][5] = true;
  128.         document.post_form.subject.value    = _sub;
  129.         for(_f=0; _f<_fields.length; _f++) {
  130.             if(document.getElementById(_f)) {
  131.                 _value = document.getElementById(_f).value;
  132.                 if(!_value || _value.match(/^s*$/)) {
  133.                     if(_f > 0 && _fields[_f][5])
  134.                         this.show_error('You have left the ' + _fields[_f][1] + ' option empty. This is a required field and as such must contain a value.');
  135.                     else
  136.                         _value = 'None';
  137.                 }
  138.                 document.post_form.message.value += '' + _fields[_f][1] + ': ' + _value + 'nn';
  139.             }
  140.         }
  141.         if(this.errors.length == 0)
  142.             document.post_form.post.click();
  143.         else
  144.             this.show_error();
  145.     },
  146.     
  147.     show_error: function() {
  148.         if("undefined" != typeof arguments[0] && arguments[0]) {
  149.             this.errors.push(arguments[0]);
  150.         } else {
  151.             // Show Errors
  152.             if(document.getElementById('status_holder')) {
  153.                 document.getElementById('status_holder_title').innerHTML = "An Error Has Occured";
  154.                 document.getElementById('status_holder_message').innerHTML = this.errors.join("<br />");
  155.                 document.getElementById('status_holder').style.display = 'block';
  156.             }
  157.         }
  158.     }
  159. }
  160. if(document.post_form && location.href.match(/action\/post\/?$/) && vf_username != 'Guest') {
  161.     _posting_form.init();
  162. }
  163. //-->
  164. </script>
 



Re: Predefined Posting Template/Form - Posted By Aiken (ionfortuna) on 18th Dec 09 at 11:26pm
Basically when somebody creates a room I add that room to the code to be selected

Re: Predefined Posting Template/Form - Posted By Nick (nickb) on 18th Dec 09 at 11:33pm
Oh I see what you mean. Just follow this format:

_fields[_f++] = new Array('select', 'Location of Room', false, ['Perfect World', '--Portal of Darkness', '--Paradise', '----Kami\'s battle house', '----Fantasia','new room 1','new room 2'], '..', true);

just add ,'new room here' when you want a new room. {Smile}

and if there is something like above "Kami's" you would want to add "Kami\'s", because without the back slash, it would break the code.

Re: Predefined Posting Template/Form - Posted By Aiken (ionfortuna) on 19th Dec 09 at 4:51am
Oh I see, alright

Re: Predefined Posting Template/Form - Posted By Aiken (ionfortuna) on 19th Dec 09 at 9:58pm
This:

Code:
 
  1. document.post_form.message.value += '' + _fields[_f][1] + ': ' + _value + 'nn';
 


Should be:

Code:
 
  1. document.post_form.message.value += '' + _fields[_f][1] + ': ' + _value + '\n';
 

Re: Predefined Posting Template/Form - Posted By Nick (nickb) on 19th Dec 09 at 10:47pm
I just took the code from the first page, and added the "_fields[_f++]" part, and it works just fine. I tried those parts with the 1 you had it didn't work, but it worked quite well with the first one on the first page. I'm still a newbie to coding. {Tongue Out} But I do know allot of it.

Re: Predefined Posting Template/Form - Posted By Aiken (ionfortuna) on 20th Dec 09 at 2:07am
With the nn it posts like:

Name1:Value1nnName2:Value2nn

With the 2nd way:

Name1:Value1
Name2:Value2

Re: Predefined Posting Template/Form - Posted By Aiken (ionfortuna) on 22nd Dec 09 at 6:26pm
Could you add radio buttons and checkboxes to the code? And maybe even blank lines if the person using it needs them?

Re: Predefined Posting Template/Form - Posted By Nick (nickb) on 23rd Dec 09 at 5:17am
I'm not sure how to do that. PM Micheal and he could do it for you. {Smile}

Re: Predefined Posting Template/Form - Posted By Michael (wrighty) on 23rd Dec 09 at 2:38pm
I don't see what you'd need check boxes or radio buttons for that a select box couldn't do. =/

Re: Predefined Posting Template/Form - Posted By Aiken (ionfortuna) on 23rd Dec 09 at 7:40pm
There are things where radio buttons and checkboxes would be better than select box,

Example 1:
Gender - Best as radio buttons

Example 2:
Multiple options that can be selected: checkboxes

I know how to do this with select box but checkboxes would just be easier on the user end

Re: Predefined Posting Template/Form - Posted By Michael (wrighty) on 24th Dec 09 at 6:12am
Gender, in my opinion would be best as a select box.

Anyway, I'm heading away for Christmas in 2 hours, so got to pack etc. I won't be able to get to this until after .... unless someone else jumps on it.

Re: Predefined Posting Template/Form - Posted By Aiken (ionfortuna) on 24th Dec 09 at 6:24am
Could I have specific select boxes change based on which gender is selected? And have a hidden field contain a random value from a list and another from a select number range?

Re: Predefined Posting Template/Form - Posted By Michael (wrighty) on 24th Dec 09 at 6:27am
Anything's possible, just wait till I return! {Smile}

Re: Predefined Posting Template/Form - Posted By Aiken (ionfortuna) on 24th Dec 09 at 6:30am
Yeah unless somebody else does it before you, anything is possible

Re: Predefined Posting Template/Form - Posted By Michael (wrighty) on 29th Dec 09 at 10:56pm
Have you decided exactly what it is that you want? 'cause it'll be quite complex for me to code it for you! {Smile}

Re: Predefined Posting Template/Form - Posted By ashkir (ashkir) on 26th May 10 at 6:03am
Does this code no longer work? :/

Re: Predefined Posting Template/Form - Posted By Ross (admin) on 26th May 10 at 1:04pm
 
Does this code no longer work? :/


I Can't think of any recent changes which would of broken this. Can you link me to a board with the problem?



Re: Predefined Posting Template/Form - Posted By Nick (nickb) on 26th May 10 at 3:14pm
Works fine for me on safari for the iPod.

Re: Predefined Posting Template/Form - Posted By ashkir (ashkir) on 26th May 10 at 9:43pm
okay. Yeah just doesn't work in opera but does in other browsers sweet. xD.

Okay, so, is there a way to fix the line spacing?

Quote:
Description: hehennType: All PagesnnExample: hehennRequest Details: hehehenn


The template shows up beautifully though. ^.^

I'm curious is it possible to have predefined UBBC code to make it "prettier"? xD

Code:
 
  1. [size=4][b]Appearance[/b][/size]
  2. [u]Hair Color:[/u]  Hair info here
  3. [u]Eye Color:[/u]  Eye info here
  4. [u]Height:[/u]  Height info here
  5. [u]Weight:[/u] Weight Box info here
  6. (Description Box here)Nunc id eros neque, at gravida tortor. Sed magna tellus, lobortis non ultrices malesuada, vestibulum nec magna. Sed tincidunt lorem eget ligula varius vulputate. Fusce id auctor nulla. Fusce odio nisl, pulvinar eu facilisis non, ultricies id diam. Nunc viverra, sapien sit amet vulputate consectetur, enim tellus euismod mauris, vel elementum erat odio nec augue. Quisque non hendrerit nisi.
 

Re: Predefined Posting Template/Form - Posted By Michael (wrighty) on 27th May 10 at 8:02am
Ashkir, have you got a link to where you're using it?

Re: Predefined Posting Template/Form - Posted By ashkir (ashkir) on 27th May 10 at 8:29am
I just took it down. But, I have a copy of part of the code. http://timeless.vforums.us

Re: Predefined Posting Template/Form - Posted By Aiken (ionfortuna) on 13th Jun 10 at 10:21pm
I fixed that part manually, had to replace the nn with [br]

Re: Predefined Posting Template/Form - Posted By batman (batman) on 18th Jul 13 at 7:04am
Hay, Some care about Predifined Scripts and templates. This one will helpful for you.