Widget:EL4C Registration

This widget transforms the registration textbox into more conventional web form.   var sb = new Object; function weRegistrationSave { var fields = Array('First name', 'Last name', 'Gender', 'Organization', 'Title/Position', 'Country of Residence', 'Email address', 'WikiEducator username'); var required = Array('weFirst', 'weLast', 'weMale', 'weOrganization', 'weTitle', 'weCountry', 'weEmail', 'weUser'); var reg = '\n'; var fail = ''; for (var i=0; i<required.length; i++) { reg += '* ' + fields[i] + ': '; var e = document.getElementById(required[i]); if (required[i] == 'weMale') { if (e && e.checked) { reg += 'Male'; } else { e = document.getElementById('weFemale'); if (e && e.checked) { reg += 'Female'; } else { fail += 'Please complete Gender field\n'; }     }      reg += '\n'; } else { if (e && e.value == '') { fail += 'Please complete ' + fields[i] + '\n'; }     reg += e.value + '\n'; } }  if (fail) { alert(fail); return false; } $('#wpTextbox1').val(reg + '\n\n'); $('#wpSave').val(sb); return true; }

$(function { while (typeof $ == 'undefined') ;    /* uncheck the checkboxes, and hide their labels */    $('#wpMinoredit, #wpWatchthis').attr('checked', '').hide.next.hide;    $('#wpSummaryLabel, #wpSummary, #fckTools, #toolbar, #wpTextbox1, #editpage-copywarn, #wpPreview, #wpDiff').hide;    $('.editHelp').hide;    $('#firstHeading').text('Learning for Content Registration');    $('#wpSave').attr('title', 'Register');    sb = $('#wpSave').val;    $('#wpSave').val( 'Register').bind('click', function { return weRegistrationSave; });    /* document.getElementById('editform').onsubmit = function {return weRegister;}; */

var f = ' '; var myForm = document.createElement('div'); myForm.id = 'myForm'; myForm.innerHTML = f;   document.getElementById('contentSub').appendChild(myForm); });