Checking participants work.



Back to Contents



First, make sure you have:

(as of June 2020)

You will learn:

  1. Validating simple form elements
  2. Validating dynamic form elements
  3. Validating actions taken in the viewer
  4. Providing error feedback


Be aware that no amount of client side validation can be trusted. If a user wants to send you empty/nonsensical data, they always can (try calling sendData() from the console as soon as the viewer loads, it's not so hard). Fortunately most users have little incentive to screw up your data so this client side validation is the best solution for you. However, if you open your experiment to anyone on the internet and have an autopayment option upon completion, validate input when the server receives it (not explicitly covered in these tutorials).

For these code heavy tutorials, it is recommended to full screen the video and watch at 720p



Resources


The changed files for this step can be found here.

Note:
  1. In the first JavaScript tutorial I recommended you make a single trial page and duplicate them after you finish this step.
    • It is recommended that you duplicate one trial completely first and write down all the steps for duplicating that trial in your specific experiment, then duplicate the rest. This is only a partial checklist, there is no way to know what every experiment needs.
    • Duplicate trial pages in v.html
      • The actual trial page
      • The trial end page (if used)
      • The debug page for each trial (if used)
      • Be sure to find/replace IDs on your old trial page with the new trial ID
    • Duplicate validation functions in customValid.js
    • Add validation/dynamic form work in customUtil.js
      • addDiagBox (if used)
      • removeDiagBox (if used)
      • scrollSuccess (if used)
    • Add each trial's windowing dropdown to sync in applyShader (if windowing is used).
    • Do a keyword search for Trial1 or whatever id was used on your original trial's page to ensure you didn't miss any IDs
    • (This can wait until after the next tutorial)
      It is recommended that you test each new trial page to ensure it validates correctly (you can set the debug button to go straight to whatever trial you're wanting to test)
      You don't have to link up each page's next button because we'll be changing this in the next tutorial. However, having some code in the onclick telling you whether or not it would have let your proceed is nice.


Proceed to learn how to randomize your trial pages