Search the Legacy Support Archive (up to v2020)
  1. Read-only archive (2005–2024). Posting is closed. Need help with MediaLab or DirectRT 2027? Email service@empirisoft.com.

    All words · “exact phrase” · -leave out

    Advanced search

Time Limit on a Custom Item Using HTML

  1. #1

    Time Limit on a Custom Item Using HTML

    I've created a Custom item in HTML. It includes 20 anagrams with separate textboxes. It works great - response go straight to SPSS. However, I only want my participants to have 10 minutes to complete it, and have the option to submit before 10 minutes are up. I've tried several combinations with durations in the questionnaire itself, or attached to the experiment file (keeping one item in the questionnaire file - that being the custom item). Problem is, the repsonses are only getting to SPSS if one clicks the submit button at the bottom of the HTML form I made before the 10 minutes have elapsed. If the task is interupted because 10 minutes have elapsed, the user either gets a noitice that time is up and to click OK or hit Enter (when the duration is int he experiemnt file), or the user is automaitcally forwarded to whatever is next in the experiment. In either case, the responses are not written to SPSS. I don't want to force my participants to hit the Submit button before the 10 minutes are up - would seem to add extra stress to the task. I'd actually only like them to use the submit button if they finish before the 10 minutes or wish not to continue with the task. However, if they reach the 10 minutes, I still want their data. I'm using version 2006. Any help would be greatly appreciated.

  2. #2
    jarvis24 Blair Jarvis, Administrator
    John, I pulled and modified this from a google search on "html submit timed". It automatically submits the form after 5 seconds if the user does not click the submit button. Will this help? Of course, you could change the 5000ms value to 30000 for a 30 second delay.

  3. #3
    The commands work!

    In the HTML form (attached), find the following line to adjust time limit. This line sets it at 540 seconds.

    <body onload="setTimeout ('document.forms[0].submit()', 540000)"> <form method="post">

    Also, the "anagram task_TEMP .htm" file that is automatically created after the experiment is run the first time appears to make the timing smoother - that is, without this file there may be a delay (blank screen) that occurs by clicking the submit button before the time limit is reached (a delay which appears to be the remainder of the available time left on the html form).

    Important commands:
    <html>
    <body onload="setTimeout ('document.forms[0].submit()', 5000)">
    <form method="post">
    <button type="submit">Submit</button>
    </form>
    </body>
    </html>

    In my html form I placed my survey between the <form method="post"> and <button type="submit">Submit</button> commands.

  4. #4
    jarvis24 Blair Jarvis, Administrator
    Thanks for the update John--and for the revised attachment! -Blair