Want to add an auto-increment of number of attempts to your web-app? here's how:

Collapse
This is a sticky topic.
X
X
 
  • Time
  • Show
Clear All
new posts
  • pbrooks
    Member
    • Mar 2007
    • 55

    #1

    Want to add an auto-increment of number of attempts to your web-app? here's how:

    I just spent a little time poking around in javascript, trying to figure out how to automatically increment the number of attempts field when you get the time for the time of last attempt button... here's what you need to do:

    inside the function SetAttTimeDate() (this is the function called when you press the "get date" button by the time of last attempt) add the following line of code:
    document.TLForm.elements.TL_ATTEMPTS_EDIT.value = parseInt(document.TLForm.elements.TL_ATTEMPTS_EDIT .value) + 1;


    Alternately, you could add a new button and function to incriment the number of attempts, but the less button pushes in my opinion the better.

    I'm always looking for ways to speed up the testing process, and make things as simple as possible... If anyone else has any helpful javascript functions for testlog, let us know!
  • Tim (PassMark)
    Senior Member
    • Mar 2005
    • 1723

    #2
    Stickied

    Comment

    • pbrooks
      Member
      • Mar 2007
      • 55

      #3
      I've modified my javascript to only increment one time per edit (so you can keep hitting the get date button and it will only add one attempt for each time you enter the edit page). Here's how:

      outside the scope of any function (at the very top of the <script> section of the template file) create a new global variable:
      var attempted = 0;

      in the function SetAttTimeDate(), replace:
      document.TLForm.elements.TL_ATTEMPTS_EDIT.value = parseInt(document.TLForm.elements.TL_ATTEMPTS_EDIT .value) + 1;

      with:
      if (attempted == 0)
      {
      document.TLForm.elements.TL_ATTEMPTS_EDIT.value = parseInt(document.TLForm.elements.TL_ATTEMPTS_EDIT .value) + 1;
      attempted = 1;
      }

      Comment

      • WatchDog
        Junior Member
        • Dec 2010
        • 6

        #4
        Only for web-app

        Hi,

        Is the Java script applicable only on the web-app version or there is a way to somehow implement it on the regular version?

        Thanks,
        Regards,

        WD

        Comment

        • Tim (PassMark)
          Senior Member
          • Mar 2005
          • 1723

          #5
          This is only applicable to the web version of TestLog.

          Comment

          Working...