View Full Version : Add javascript button to VB registration page
CampinCarl
03-01-2009, 05:23 PM
I'm trying to figure out how to add a button to the registration page that will run some javascript when clicked on.
Is there some option in the vb control panel that allows this, or do I have to modify some files or something?
Any help is greatly appreciated :)
Mr-Moo
03-01-2009, 06:00 PM
Hello There,
I would love to help you!
If it is a javascript and includes no php then you can simply do this through the Vbulletin control panel. Please navigate yourself to the "Styles & Templates" and click on "Search in Templates".
You want to search for "register" and search in the template which is primary. Scroll through until you see a template file with the name "register". Double click and add your javascript code in the desired positions.
Hope that helps, let me know if you have any issues!
Dismounted
03-02-2009, 05:08 AM
<a href="http://www.vbulletin.com/docs/html/styles_and_templates" target="_blank">The manual also talks about styles and templates.</a>
CampinCarl
03-08-2009, 05:48 AM
Thank you both for your help this far. Now another question :)
I created 2 new textboxes via the template. Is there a way I can save the information the user enters in these textboxes to the users database?
I thought about editing the register.php file but then a vBulletin update might break my custom code?
Dismounted
03-08-2009, 10:32 AM
What you are probably looking for is a custom profile field - again, have a look in the manual for that.
CampinCarl
03-08-2009, 10:07 PM
Thanks, I actually knew about the custom user fields but didn't think to work my javascript around them.
Now one last question until I have this small project completed (and I did look in the manual but couldn't find help on it!):
When a user is registering, is it possible to check a custom field to see if another user already has the value in that field? I don't want any 2 users having the same value in the custom field I created.
Dismounted
03-09-2009, 05:03 AM
To do that, you will need to add a plugin to check the fields, and spit an error if needed. The hook you probably want is userdata_presave.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.