.NET Version Feature and Thread Titles
This may be more trouble than it's worth, but I was wondering whether it would be possible to add the .NET version to the thread title when the user presses the Submit button rather than when they check a radio button. As it stands, if someone checks a radio button the version is added to the thread title, which means that the title is not empty and the thread can be sumitted. If the version wasn't added until after the title was validated this would force those who either don't bother or forget to provide a proper thread title instead of just a version.
Re: .NET Version Feature and Thread Titles
That could work. As long as it was done in Javascript... I'll see if it does.
Re: .NET Version Feature and Thread Titles
Yeah, it seems to work better.
Since I coded it up to test it, might as well post the code. I guess Joe will see it sometime.
Top to bottom on the template:
// Replaces VSver()
Code:
var vs_ver = null;
function setVSver(ver)
{
vs_ver = ver;
}
function addVSver()
{
if (vs_ver == null) {
alert('Please select your version of Visual Studio using the radio buttons.');
return false; // Cancel the submit
}
var titleElement = document.getElementById('title');
if (titleElement.value.match(/\[[0-9\/]{4,5}\]/))
titleElement.value = titleElement.value.replace(/\[[0-9\/]{4,5}\]/, ver);
else
titleElement.value = vs_ver + ' ' + titleElement.value;
}
// Replaces opening <form action="newthread.php"> line
HTML Code:
<!-- P: Validate title/post BEFORE VS version -->
<form
action="newthread.php"
method="post"
name="vbform"
onsubmit="return validatePost(this, this.subject.value, 4, 10000) && addVSver();"
onreset="vB_RESET(this);"
>
// Also added <label> tags for the radio buttons. Makes the UI work a bit better.
HTML Code:
Please select your version of Visual Studio:
<input type="radio" id="vs03" name="vs" onclick="setVSver('[02/03]')" /><label for="vs03">VS 02/03</label>
<input type="radio" id="vs05" name="vs" onclick="setVSver('[2005]')" /><label for="vs05">VS 2005</label>
I do realise that makes the VS version mandatory. If that's not a desirable effect then just take out the if (vs_ver == null) section and add a return true at the end of that function.
Re: .NET Version Feature and Thread Titles
I believe it should be compulsary for people to provide a VS version when they sign up. Or at least make using the version option buttons compulsary. It would save a lot of time and space having to ask people what version they are using or even replying with incorrect instructions.
Re: .NET Version Feature and Thread Titles
There would be no required code change if you suggested making a forum for each .Net version.