The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Modify value of registration forms at submission
I'm not letting my users choose a username, instead I'm using their email address to create it for them.
I have a simple jscript function that pulls their username from their email address. In that same function, I'm setting the value of the username element in the form. I'm pretty sure the function is running prior to the form being submitted, but upon testing, it tells me I haven't entered a username. I've included my code below: Code:
function createUserName(email) { var emailIndex = email.indexOf("@") - 1; document.forms.register.username.value = email.substr(1, emailIndex); } Code:
<input type="submit" class="button" value="$vbphrase[complete_registration]" accesskey="s" onClick=createUserName(email.value) /> Seems I didn't do anything wrong, but when I pulled the username out of the form, I forgot to readd a hidden element, so although my code was working, it couldn't actually set the value of an element that didn't exist. I added the following: Code:
<input type=hidden name="username" /> |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|