There is no means to do this logic on the server, but you can do pre-POPST tricks on the client side.
Edit the submit field for the self-registration form, click Advanced and enter RegisterSubmit under AJAX Submit.
Edit the Footer HTML of the registration form and put this script template in place. This is a simple proof of concept that takes the phone number, strips non-numeric numers, and reverses it to use as the username. You would need to check the email and set the other fields using your own logic.
<script type="text/JavaScript"><!--{literal}
function RegisterSubmit(form_name) {
var frm = document.forms[form_name];
var error = '';
// Checking here...
if (error != '') {
alert(error);
Nwa_EnableFormButtons(form_name);
return false;
}
// Reverse the phone number and put it as the username.
if (frm.visitor_phone.value != '') {
var name = '';
var phone = frm.visitor_phone.value.split('');
for (var i = 0; i < phone.length; i++) {
var charCode = phone[i].charCodeAt(0);
if((charCode > 47) && (charCode < 58)) {
name = phone[i] + name;
}
}
frm.username.value = name;
}
return true; // Proceed to regular
}
//-->
{/literal}</script>
Word of caution that someone with strong HTML and scripting prowress can work around this...