Millisecond Forums

Record latency of each textbox in a survey

https://forums.millisecond.com/Topic33833.aspx

By riri21 - 1/27/2022

Hi, 

I have multiple textboxes in a surveypage. 
Right now, my output is treating every textbox as a part of the same trial so the recorded latency for each textbox is the same within a surveypage.
However, I want to record the time it takes a participant to fill in each textbox.
How should I do this?

Attached is my script for reference.

Thank you,

Ari
By Dave - 1/27/2022

riri21 - 1/27/2022
Hi, 

I have multiple textboxes in a surveypage. 
Right now, my output is treating every textbox as a part of the same trial so the recorded latency for each textbox is the same within a surveypage.
However, I want to record the time it takes a participant to fill in each textbox.
How should I do this?

Attached is my script for reference.

Thank you,

Ari

It's not possible if the textboxes are all on the same surveypage.
By riri21 - 1/27/2022

Dave - 1/27/2022
riri21 - 1/27/2022
Hi, 

I have multiple textboxes in a surveypage. 
Right now, my output is treating every textbox as a part of the same trial so the recorded latency for each textbox is the same within a surveypage.
However, I want to record the time it takes a participant to fill in each textbox.
How should I do this?

Attached is my script for reference.

Thank you,

Ari

It's not possible if the textboxes are all on the same surveypage.

Hi Dave,

Thanks for your quick reply. Is there any way I can record the latencies of each open-ended response independently, but so they're all displayed on the same page? It doesn't necessarily have to be a survey.

Thanks,

Ari
By Dave - 1/27/2022

riri21 - 1/27/2022
Dave - 1/27/2022
riri21 - 1/27/2022
Hi, 

I have multiple textboxes in a surveypage. 
Right now, my output is treating every textbox as a part of the same trial so the recorded latency for each textbox is the same within a surveypage.
However, I want to record the time it takes a participant to fill in each textbox.
How should I do this?

Attached is my script for reference.

Thank you,

Ari

It's not possible if the textboxes are all on the same surveypage.

Hi Dave,

Thanks for your quick reply. Is there any way I can record the latencies of each open-ended response independently, but so they're all displayed on the same page? It doesn't necessarily have to be a survey.

Thanks,

Ari

The short answer is no, the long answer is that you can perhaps build something like the below contraption:


<values>
/ w1 = ""
/ w2 = ""
/ w3 = ""
/ w1_latency = 0
/ w2_latency = 0
/ w3_latency = 0

/ round = 0
</values>

<block example>
/ trials = [1-3 = trial.start]
</block>

<trial start>
/ ontrialbegin = [
    // reset variables at start of round
    values.w1 = "";
    values.w2 = "";
    values.w3 = "";
    values.w1_latency = 0;
    values.w2_latency = 0;
    values.w3_latency = 0;
    
    values.round += 1;
]
/ branch = [
    return trial.boxselection;
]
/ validresponse = (0)
/ trialduration = 0
/ recorddata = false
</trial>

<trial boxselection>
/ stimulusframes = [1=clearscreen, round, wb1, wb2, wb3, submit]
/ inputdevice = mouse
/ validresponse = (wb1, wb2, wb3, submit)
/ isvalidresponse = [
    if (trial.boxselection.response == "submit" && (values.w1 == "" || values.w2 == "" || values.w3 == "")){
        return false;
    } else {
        return true;
    };
]
/ branch = [
    if (trial.boxselection.response == "wb1") {
        return openended.w1;
    } else if (trial.boxselection.response == "wb2") {
        return openended.w2;
    } else if (trial.boxselection.response == "wb3") {
        return openended.w3;
    } else {
        return trial.logdata;
    };
]
/ recorddata = false
</trial>

<openended w1>
/ ontrialend = [
    values.w1 = openended.w1.response;
    values.w1_latency += openended.w1.lastcharlatency; // add time when subject stopped typing
]
/ stimulusframes = [1=clearscreen, round, wb1, wb2, wb3]
/ defaultresponse = values.w1
/ mask = alphabetic
/ position = (25%, 60%)
/ size = (15%, 12%)
/ multiline = false
/ required = true
/ branch = [
    return trial.boxselection;
]
/ recorddata = false
</openended>

<openended w2>
/ ontrialend = [
    values.w2 = openended.w2.response;
    values.w2_latency += openended.w2.lastcharlatency; // add time when subject stopped typing
]
/ stimulusframes = [1=clearscreen, round, wb1, wb2, wb3]
/ defaultresponse = values.w2
/ mask = alphabetic
/ position = (50%, 60%)
/ size = (15%, 12%)
/ multiline = false
/ required = true
/ branch = [
    return trial.boxselection;
]
/ recorddata = false
</openended>

<openended w3>
/ ontrialend = [
    values.w3 = openended.w3.response;
    values.w3_latency += openended.w3.lastcharlatency; // add time when subject stopped typing
]
/ stimulusframes = [1=clearscreen, round, wb1, wb2, wb3]
/ defaultresponse = values.w3
/ mask = alphabetic
/ position = (75%, 60%)
/ size = (15%, 12%)
/ multiline = false
/ required = true
/ branch = [
    return trial.boxselection;
]
/ recorddata = false
</openended>

<trial logdata>
/ validresponse = (0)
/ trialduration = 0
</trial>

<text wb1>
/ items = ("<%values.w1%>")
/ hjustify = left
/ vjustify = center
/ txbgcolor = grey
/ position = (25%, 50%)
/ size = (15%, 10%)
/ erase = false
</text>

<text wb2>
/ items = ("<%values.w2%>")
/ hjustify = left
/ vjustify = center
/ txbgcolor = grey
/ position = (50%, 50%)
/ size = (15%, 10%)
/ erase = false
</text>

<text wb3>
/ items = ("<%values.w3%>")
/ hjustify = left
/ vjustify = center
/ txbgcolor = grey
/ position = (75%, 50%)
/ size = (15%, 10%)
/ erase = false
</text>

<text round>
/ items = ("Round #<%values.round%>")
/ position = (50%, 10%)
/ erase = false
</text>

<button submit>
/ caption = "SUBMIT"
/ size = (15%, 10%)
/ position = (50%, 90%)
/ erase = false
</button>

<data>
/ columns = (date time subject group session values.round values.w1 values.w1_latency values.w2 values.w2_latency values.w3 values.w3_latency)
/ separatefiles = true
</data>