Millisecond Forums

Tab order and set focus

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

By CatK - 4/22/2020

Hi there,

is it possible to set the focus on a specific textbox, when the page initially loads?

Similar to the .focus() method in JavaScript?

Also can we set the tab order of elements on a page in Inquisit?

TIA
By Dave - 4/22/2020

CatK - 4/22/2020
Hi there,

is it possible to set the focus on a specific textbox, when the page initially loads?

Similar to the .focus() method in JavaScript?

Also can we set the tab order of elements on a page in Inquisit?

TIA

There is no .focus() method, but there is a sneaky way to set the focus under some circumstances. If a textbox is set as the 1st question in the page's /questions, it should receive focus when the page loads. Suppose you have a page with three textboxes A, B and C, and wish to set the focus to the middle one (B), then you could do

<surveypage example>
/ questions = [1=b; 2=a; 3=c;]
/ showquestionnumbers = false
/ showpagenumbers = false
</surveypage>

<textbox a>
/ caption = "a"
/ position = (10%, 20%)
</textbox>

<textbox b>
/ caption = "b"
/ position = (10%, 40%)
</textbox>

<textbox c>
/ caption = "c"
/ position = (10%, 60%)
</textbox>

Tab order, I believe, should also follow the order given in /questions, so it should be B -> A -> C -> Continue Button -> B -> A -> C -> ...in the above example.
By CatK - 4/22/2020

Dave - 4/22/2020
CatK - 4/22/2020
Hi there,

is it possible to set the focus on a specific textbox, when the page initially loads?

Similar to the .focus() method in JavaScript?

Also can we set the tab order of elements on a page in Inquisit?

TIA

There is no .focus() method, but there is a sneaky way to set the focus under some circumstances. If a textbox is set as the 1st question in the page's /questions, it should receive focus when the page loads. Suppose you have a page with three textboxes A, B and C, and wish to set the focus to the middle one (B), then you could do

<surveypage example>
/ questions = [1=b; 2=a; 3=c;]
/ showquestionnumbers = false
/ showpagenumbers = false
</surveypage>

<textbox a>
/ caption = "a"
/ position = (10%, 20%)
</textbox>

<textbox b>
/ caption = "b"
/ position = (10%, 40%)
</textbox>

<textbox c>
/ caption = "c"
/ position = (10%, 60%)
</textbox>

Tab order, I believe, should also follow the order given in /questions, so it should be B -> A -> C -> Continue Button -> B -> A -> C -> ...in the above example.

Thank you so much!