Post by diniveka on Mar 13, 2010 21:57:43 GMT -8
Example URL: ultimateparanoia.proboards.com/index.cgi?board=crossbreedbios
Description: I have been editing the codes to fit a Character Creation Form, and it SHOULD work, but something is preventing it from coming up. I have double-checked to make sure there was nothing that could interfere with it, but it's still not working. Can someone please take a look at it and tell me why it's going funny?
Experienced By: Everyone
Code URL: support.proboards.com/index.cgi?board=codedatabase&action=display&n=1&thread=70752
Code:
Web Browser: Not sure
Forum URL: ultimateparanoia.proboards.com/index.cgi?
Description: I have been editing the codes to fit a Character Creation Form, and it SHOULD work, but something is preventing it from coming up. I have double-checked to make sure there was nothing that could interfere with it, but it's still not working. Can someone please take a look at it and tell me why it's going funny?
Experienced By: Everyone
Code URL: support.proboards.com/index.cgi?board=codedatabase&action=display&n=1&thread=70752
Code:
<script type="text/javascript">
<!--
/* Predefined Posting Template/Form
Created by Ross of PBS
Please do not repost outside of PBS without permission */
var _title = 'Crossbreed Creation Form';
var _description = 'PLEASE ENSURE THAT YOU HAVE READ THE <a href="http://ultimateparanoia.proboards.com/index.cgi?board=rulescodes&action=display&thread=1">RULES</a> BEFORE POSTING!';
var _fields = new Array(); var _f = 0;
_fields[_f++] = new Array('input', 'Subject Title:', ['size', 60, 'maxLength', 50], '', 'This will be the name of your thread.', true);
_fields[_f++] = new Array('input', 'Character Name:', ['size', 60, 'maxLength', 50], '', 'Please write your characters name.', true);
_fields[_f++] = new Array('input', 'Age:', ['size', 60, 'maxLength', 50], '', 'Your characters age.', true);
_fields[_f++] = new Array('select', 'Gender:', [], ['Male', 'Female'], 'Either a guy or a gal', true);
_fields[_f++] = new Array('input', ‘Parent Types:', ['size', 60, 'maxLength', 50], '', 'What are the parents\' creature types?', true);
_fields[_f++] = new Array('textarea', 'Physical Appearance:', ['cols', 70, 'rows', 5], '', 'A description of what your charrie looks like. A minimum of five good length sentences is required, OR an image accompanied by 2-3 good length sentences.', true);
_fields[_f++] = new Array('textarea', 'Personality Description:', ['cols', 70, 'rows', 5], '', 'A description of your character\'s personality. A minimum of five good length sentences is required.', true);
_fields[_f++] = new Array('textarea', 'History:', ['cols', 70, 'rows', 5], '', 'What happened in your person\'s past? Please make it realistic. A minimum of seven good length sentences is required.', true);
_fields[_f++] = new Array('textarea', 'Likes/Dislikes(optional):', ['cols', 70, 'rows', 5], '', 'Your person\'s likes and dislikes.', false);
_fields[_f++] = new Array('input', 'Codeword:', ['size', 60, 'maxLength', 50], '', 'Hidden in the rules is a codeword. This item is compulsory when creating a character.', true);
var _widths = ['100%', '30%', '35%', '35%'];
var _posting_form = {
errors: new Array(),
init: function() {
this.create_form();
},
create_form: function() {
// Create new post layout
var _holder = document.createElement('table');
_holder.setAttribute('className', 'bordercolor');
_holder.setAttribute('class', 'bordercolor');
_holder.setAttribute('cellSpacing','1');
_holder.setAttribute('cellPadding', '4');
_holder.setAttribute('align', 'center');
_holder.setAttribute('width', _widths[0]);
_holder.setAttribute('id', 'post_form_holder');
_holder.appendChild(document.createElement('tbody'));
_holder.firstChild.appendChild( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
_holder.firstChild.lastChild.lastChild.className = 'titlebg';
_holder.firstChild.lastChild.lastChild.colSpan = '3';
_holder.firstChild.lastChild.lastChild.lastChild.size = '2';
_holder.firstChild.lastChild.lastChild.lastChild.appendChild(document.createTextNode(_title));
if(_description) {
_holder.firstChild.appendChild( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
_holder.firstChild.lastChild.lastChild.setAttribute('className', 'windowbg');
_holder.firstChild.lastChild.lastChild.setAttribute('class', 'windowbg');
_holder.firstChild.lastChild.lastChild.setAttribute('colSpan', '3');
_holder.firstChild.lastChild.lastChild.lastChild.setAttribute('size', '2');
_holder.firstChild.lastChild.lastChild.lastChild.innerHTML = _description;
}
for(_f=0; _f<_fields.length; _f++) {
switch(_fields[_f][0]) {
case 'textarea' :
var _tmp = document.createElement('textarea');
break;
case 'select' :
var _tmp = document.createElement('select');
for(_o=0; _o<_fields[_f][3].length; _o++) {
_tmp.options[_o] = new Option(_fields[_f][3][_o], _fields[_f][3][_o]);
}
break;
default :
var _tmp = document.createElement('input');
_tmp.type = 'text';
if("undefined" != typeof _fields[_f][3] && _fields[_f][3] != "")
_tmp.setAttribute('value', _fields[_f][3]);
break;
}
_tmp.setAttribute('id', _f);
if("undefined" != typeof _fields[_f][2] && _fields[_f][2].length > 0) {
for(_a=0; _a<_fields[_f][2].length; _a++) {
_tmp.setAttribute(_fields[_f][2][_a++], _fields[_f][2][_a]);
}
}
var _class = 'windowbg' + ((_f % 2 == 0)? '2' : '');
var _row = document.createElement('tr');
_row.appendChild(document.createElement('td'));
_row.lastChild.setAttribute('class', _class);
_row.lastChild.setAttribute('className', _class);
_row.lastChild.setAttribute('vAlign', 'top');
_row.lastChild.setAttribute('width', _widths[1]);
_row.lastChild.appendChild(document.createElement('font'));
_row.lastChild.lastChild.setAttribute('size', '2');
_row.lastChild.lastChild.style.fontWeight = 'bold';
_row.lastChild.lastChild.appendChild(document.createTextNode(_fields[_f][1] + ':'));
_row.appendChild(document.createElement('td'));
_row.lastChild.setAttribute('class', _class);
_row.lastChild.setAttribute('className', _class);
_row.lastChild.setAttribute('width', _widths[2]);
_row.lastChild.appendChild(document.createElement('font'));
_row.lastChild.lastChild.setAttribute('size', '2');
_row.lastChild.lastChild.appendChild(_tmp);
_row.appendChild(document.createElement('td'));
_row.lastChild.setAttribute('class', _class);
_row.lastChild.setAttribute('className', _class);
_row.lastChild.setAttribute('vAlign', 'top');
_row.lastChild.setAttribute('width', _widths[3]);
_row.lastChild.appendChild(document.createElement('font'));
_row.lastChild.lastChild.size = '1';
_row.lastChild.lastChild.appendChild(document.createTextNode(_fields[_f][4]));
_holder.firstChild.appendChild(_row);
}
var _submit = document.createElement('tr');
_submit.appendChild(document.createElement('td'));
_submit.lastChild.setAttribute('class', 'windowbg' + (((_f+1) % 2 == 0)? '' : '2'));
_submit.lastChild.setAttribute('className', 'windowbg' + (((_f+1) % 2 == 0)? '' : '2'));
_submit.lastChild.setAttribute('align', 'center');
_submit.lastChild.setAttribute('colSpan', 3);
var _button = document.createElement('input');
_button.setAttribute('type', 'button');
_button.setAttribute('value', 'Post Message');
_button.onclick = function() { _posting_form.post_it(); };
_submit.lastChild.appendChild(_button);
_holder.firstChild.appendChild(_submit);
var _tables = document.getElementsByTagName('table');
for(_t=0; _t<_tables.length; _t++) {
if(_tables.item(_t).cellPadding == '0' && _tables.item(_t).className == 'bordercolor' && _tables.item(_t).firstChild.nodeName.toLowerCase() == 'form') {
_tables.item(_t).style.display = 'none';
_tables.item(_t).parentNode.insertBefore(_holder, _tables.item(_t));
break;
}
}
},
post_it: function() {
// create message and attempt to post it
this.errors = new Array();
document.postForm.message.value = document.postForm.subject.value = '';
var _sub = document.getElementById('0').value;
_fields[0][5] = true;
document.postForm.subject.value = _sub;
for(_f=0; _f<_fields.length; _f++) {
if(document.getElementById(_f)) {
_value = document.getElementById(_f).value;
if(!_value || _value.match(/^\s*$/)) {
if(_f > 0 && _fields[_f][5])
this.show_error('You have left the ' + _fields[_f][1] + ' option empty. This is a required field and as such must contain a description.');
else
_value = 'None';
}
document.postForm.message.value += '' + _fields[_f][1] + ': ' + _value + '\n\n';
}
}
if(this.errors.length == 0)
document.postForm.submit(true);
else
this.show_error();
},
show_error: function() {
if("undefined" != typeof arguments[0] && arguments[0]) {
this.errors.push(arguments[0]);
} else {
// Show Errors
if(document.getElementById('error_holder')) {
document.getElementById('error_holder').innerHTML = this.errors.join("<br />");
} else {
var _error_holder = document.createElement('table');
_error_holder.className = 'bordercolor';
_error_holder.cellSpacing= '1';
_error_holder.cellPadding = '4';
_error_holder.align = 'center';
_error_holder.width = _widths[0];
_error_holder.appendChild(document.createElement('tbody'));
_error_holder.firstChild.appendChild(document.createElement('tr')).appendChild(document.createElement('td')).appendChild (document.createElement('font'));
_error_holder.firstChild.lastChild.lastChild.setAttribute('className', 'titlebg');
_error_holder.firstChild.lastChild.lastChild.lastChild.setAttribute('size', '2');
_error_holder.firstChild.lastChild.lastChild.lastChild.setAttribute('innerHTML', 'An Error Has Occured');
_error_holder.firstChild.appendChild(document.createElement('tr')).appendChild(document.createElement('td')).appendChild (document.createElement('font'));
_error_holder.firstChild.lastChild.lastChild.setAttribute('className', 'windowbg');
_error_holder.firstChild.lastChild.lastChild.lastChild.setAttribute('size', '2');
_error_holder.firstChild.lastChild.lastChild.lastChild.setAttribute('id', 'error_holder');
_error_holder.firstChild.lastChild.lastChild.lastChild.setAttribute('innerHTML', this.errors.join("<br />") );
var _holder = document.getElementById('post_form_holder');
_holder.parentNode.insertBefore(_error_holder, _holder);
_holder.parentNode.insertBefore(document.createElement('br'), _holder);
}
}
}
}
if(document.postForm && location.href.match(/action=post(#\w+)?$/) && pb_username != 'Guest') {
_posting_form.init();
}
//-->
</script>
Web Browser: Not sure
Forum URL: ultimateparanoia.proboards.com/index.cgi?