PDA

View Full Version : Auto Close All Tags


Mutt
01-25-2002, 07:44 PM
OK, this is real quick. I hate when a user tries to use the vb code buttons, but doesn't close the tags. They get all upset that the buttons didn't work. Now, my site closes tha tags for them.

go through the templates for any post pages that use the vbcode buttons.

look for
function validate(theform) {

and right after it add
closeall(theform);

done

now when they submit the form, it automatically hits the 'Close All Tags' button

Admin
01-26-2002, 04:01 AM
Good idea, but it will only close tags that were created by vBulletin, i.e the user clicks Enhaced Mode then opens a tag... it won't close it if I just type it in.

Mutt
01-27-2002, 11:29 PM
Firefly you are correct, but the people that type the tags ususally know to close them. it's the people that just push the bold button and then get aggrivated that their post isn't bold that I was trying to help out. It's not fool proof, but it should help someof the time

here's a little something else. it's not neccessary, but I felt it was nicer. now when you submit the form, the page is crolled up a little to bring the focus back to the message text area regaurdless of whether any end tags were added or not. I move one line in vbcode.js to fix this. I know now this is a hack instead of a template mod, but like I said, it's not necessary

open vbcode.js and scroll down to
function closeall(theform)

find the line
theform.message.focus();

and move it to right after
AddText(Addtxt,theform);

now the message window will only be brought into focus if tags are added. if you made your post correctly, nothing will happen.