Hello All,
I want to write a script to combine the first name and last name to generate the email
automatically.
For example first name is Bat Second is man then the email is bat.man(a)yahoo.com
automatically.
This is done already in the username field so I made a script exactly the same but with
different name ofcourse and variables.
Problem is that its working as long as I comment the script for generating the username.
They never work together, I have to comment one so the other works.
thats the code in register inline
<dt>$msg.get("core.register.username")</dt>
<dd></dd>
#set($prop = $class.password)
<dt>$msg.get("core.register.password")</dt>
<dd>$doc.displayEdit($prop, "register_", $obj)</dd>
<dt>$msg.get("core.register.passwordRepeat")</dt>
<dd>$doc.displayEdit($prop, "register2_", $obj)</dd>
#set($prop = $class.email)
<dt>$msg.get("core.register.email")</dt>
<dd>
in the xwiki.js in the albatross folder I added this function
function prepareEmail(form) {
var fname = form.register_first_name.value;
var lname = form.register_last_name.value;
var cxwikiemail = form.xwikiemail;
if (fname != "") {
fname = fname.substring(0,1).toUpperCase() + fname.substring(1);
fname.replace(/ /g,"");
}
if (lname != "") {
lname = lname.substring(0,1).toUpperCase() + lname.substring(1);
lname.replace(/ /g,"");
}
if (cxwikiemail.value == "") {
var eadr = fname+"."+lname+"(a)yahoo.com"uot;@yahoo.com";
cxwikiemail.value = noaccent(eadr);
}
}
Any idea why this is not working, i tried everything and no hope :(
Many thanks in advance
Hosam