Results 1 to 5 of 5

Thread: .NET Version Feature and Thread Titles

  1. #1

    Thread Starter
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    .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.
    Last edited by jmcilhinney; Jun 7th, 2006 at 11:30 PM.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: .NET Version Feature and Thread Titles

    That could work. As long as it was done in Javascript... I'll see if it does.

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    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.

  4. #4
    Fanatic Member dom_stapleton's Avatar
    Join Date
    Sep 2005
    Location
    Leigh-on-Sea, UK
    Posts
    665

    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.
    I use Microsoft Visual Basic 2008 Express Edition.

    If my post has been helpful, please rate it, unless you don't believe in Karma... which actually I don't!

    Resources:
    Visual Basic Tutorials (1, 2) | MSDN Library | Google | Krugle | Search Forums

    Free components:
    Windows Forms Components | XP Common Controls Library

  5. #5

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width