View Full Version : Is it possible to automatically prefill the title field when creating a new thread?
greigeh
04-30-2015, 12:57 AM
Hey,
the title might sound confusing but it's a lot more straightforward than it sounds. Does vBulletin have a way in which by clicking a link to make a new thread for example:
http://popoverdose.com/newthread.php?do=newthread&f=29&title=hey
it would automatically type in the title field 'hey'? Or would this require a plugin?
Thanks
PinkMilk
05-04-2015, 12:12 AM
I would think it is, I've be able to grab the get var using javascript but for some reason its not adding it to the input.
All edits are made in the newthread template
Just below <head> I added this:
<script type="text/javascript">
// this function grabs the hey from &title=hey
function getUrlVars() {
var vars = {},
parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
vars[key] = value;
});
return vars;
}
// Making life easier, cleaning text up and relevant get var
var newtitle = decodeURIComponent(getUrlVars()["title"]);
// this should add the hey as the inputs value but it doesn't and I'm not sure why
document.getElementById("titlefromurl").value=newtitle;
</script>
and added new id to the relevant input:
<input id="titlefromurl" type="text" class="bginput" name="subject"
Obviously this only partially works and so not very helpful to you just yet but I thought I would post it in case others my be able to do something with it and get it working.
I think this might be what we were talking about in this thread: https://vborg.vbsupport.ru/showthread.php?t=285718
greigeh
05-04-2015, 08:25 PM
Thanks a bunch!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.