// Sign Up $(function() { $("form input").keypress(function (e) { if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) { $('input[name=next]').click(); return false; } else { return true; } }); }); function checkWorkEMail(module) { document.forms['contacts'].elements['email'].value = document.forms['contacts'].elements['email'].value.replace(/ +/g, ''); var thatEmail = document.forms['contacts'].elements['email'].value; var introMsg = "If at all possible, use an e-mail address issued by a company, school or governmental organization that we can easily verify."; // No @ or @ as first char. entity type on the off chance they click Submit without filling in an email if (thatEmail == '') { $('#extraForm').html(introMsg); return true; } // Force blink for UI purposes $('#emailError').children('td:nth-child(2)').html(' '); $('#extraForm').html('Loading...'); $.get(handler, { 'method': 'chooseEntity', 'module': module, 'email': thatEmail }, function(reply) { if (reply.error) { $('#emailError').children('td:nth-child(2)').html(reply.html); $('#extraForm').html(introMsg); document.forms['contacts'].elements['email'].parentNode.parentNode.children[0].className = 'error'; document.forms['contacts'].elements['email'].parentNode.parentNode.children[1].className = 'error'; } else { $('#emailError').children('td:nth-child(2)').html(''); $('#extraForm').html(reply.html); document.forms['contacts'].elements['email'].parentNode.parentNode.children[0].className = 'medium'; document.forms['contacts'].elements['email'].parentNode.parentNode.children[1].className = 'medium'; // On Dynamic Refresh Type-Ahead $("#ac_signup_title").autoComplete(handler, {'minChars': 2, 'maxItemsToShow': 10, 'extraParams': {'method': 'suggestTitle'}}); $("#ac_signup_department").autoComplete(handler, {'minChars': 2, 'maxItemsToShow': 10, 'extraParams': {'method': 'suggestDepartment'}}); } }); return true; } // Avoid the Return-versus-Tab problem by preventing submit. function dontSubmitTooSoon(event) { return event.keyCode != 13; }