up Inquisit Language Reference

isValidResponse attribute

The isValidResponse attribute specifies custom logic used to classify a response as valid or invalid.

Member of

<trial> <likert> <openended> <sliderTrial>

Syntax

/ isValidResponse = { script }

Parameters

Name Type Description
script script An expression that returns boolean true or false. See help with expression syntax for more information.

Remarks

After a response is made on a given trial, this parameter specifies an expression to be evaluated that determines whether the response should be scored as valid or invalid. If the expression returns a logical value of true (any non-null or nonzero value), the response is considered valid. If the expression returns boolean false (zero or null), the response is considered invalid.

This command can be used instead of or in conjunction with validResponse to define dynamic or conditional rules for judging response accuracy.

Requires an explicit 'return' statement.

Examples

The following classifies the response as valid if the latency is greater than a minimum response time, and the scancode of the key press is 1 or 2. Note that 'this' represents 'trial.myTrial' in this context.

<trial myTrial>
/ stimulusTimes=[0=teststim]
/ isValidResponse={ return (this.latency > values.minTime && (this.responseText == "1" || trial.myTrial.responseText == "2"));}
</trial>

The following classifies the response as valid if it has exactly 5 characters. Note that 'this' represents 'openended.id'.

<openended id>
/ stimulusTimes=[0=enterid]
/ isValidResponse={ return length(this.response) == 5;}
</trial>

The following classifies the response as valid based on a predefined expression:

<trial myTrial>
/ stimulusTimes=[0=teststim]
/ isValidResponse={ return expressions.validationlogic;}
</trial>

Copyright Millisecond Software, LLC. All rights reserved.