How does SetFocusID work?


#1

Hi Guys,

I am working on a project and would like to have it go to a specific input when opening the form. I think SetFocusID should do that, but I am not able to get it to work that way.

I would also like it to go to the next form if someone fills in the input field and presses enter. Is that possible?

Thanks!


#2

The function to set the focus to a control is focus, as in

Input1.focus()

Going to the next form if someone hits return may not be want you want. If the user is on a mobile device, they won’t be hitting return (or tab) to go to the next field. They’ll just tap on the next field. Instead, you could check if they are leaving the field: (aircode in BASIC)

Function Input1_onblur()
  ChangeForm(Form2)
End Function

JavaScript:

Input1.onblur = function() {
  ChangeForm(Form2);
}

#3

Hi George,

In this case, I have put the input1.focus() in the code for the form, and that didn’t provide focus there (testing using Chrome and IE on my laptop).

In my case, I am asking for an ‘order number’ and then I want it to go to the next page when someone hits enter or I can do the onblur since that is useful as well. But this will be running most likely on IE on a Zebra scanner. So I want them to be able to punch in the order number and then go to the next form.

From there, I am going to use a keyboard ‘wedge’ to scan in a long barcode, and that will press enter at the end, but I might be able to have it ‘onblur’ and send a tab after the read of the barcode. I will then have a ‘finish’ button as they will be scanning between 1 and 1000 items that are attached to that order on the first screen.

On the ‘finish’ the intention is to ajax it to put that data into the database, and then return to the ask for an order screen so I can start this process again.

Thanks!


#4

I am also doing this in 7.0.2.

Thanks!

Chris