PDA

View Full Version : Question Inputfield - Set Focus


Byte
11-03-2005, 03:44 AM
hi,

i have 4 inputfields in which the user enters a serialnumber. i set the input mask, so the user can only enter 4 digits in each field.
is it possible to set the focus on the next inputfield after the 4th digit is entered?

byte

Worm
11-03-2005, 06:07 AM
Use String.Length in the On Key event to see if the length is == 4, if so Page.SetFocus to the next object

Byte
11-03-2005, 06:29 AM
hi Worm,

thanks for the answer. this is what i got.

RegInputSerial1 = Input.GetText("Input_Serial1");

StrLength1 = String.Length(RegInputSerial1);

if StrLength1 == 4 then
Page.SetFocus("Input_Serial2");
end


but it is not working, with a input mask, only if the inputfield is a standard field.

byte

Worm
11-03-2005, 06:53 AM
Give this a try

--trim out your place holder
RegInputSerial1 = String.TrimRight(Input.GetText("Input_Serial1"), " ");

StrLength1 = String.Length(RegInputSerial1);

if StrLength1 == 4 then
Page.SetFocus("Input_Serial2");
end

Byte
11-03-2005, 07:55 AM
kind of works, but if i move the mouse over the inputfields, all numbers disapear.

byte

Worm
11-03-2005, 08:01 AM
This seems to work for me. Maybe I missed something in my explanation, or I missed something in yours in how you wanted it to work.

Byte
11-03-2005, 08:13 AM
in your example it works fine, but even if i copy your code into my project, it still deletes the number if i move the mouse over the inputfields.

byte

Worm
11-03-2005, 08:26 AM
When you move the mouse over the object, or click in it?

Do you have any other code or objects below with On Enter code?

Byte
11-03-2005, 08:39 AM
when i move the mouse over the object

i have 2 buttons below. one of them sends the information to a php script and the other one exits the programm.

byte

Worm
11-03-2005, 09:04 AM
There must be some code somewhere with a On Enter or the Page's Mouse events that is doing it. If you can't find it, you can post the app

Byte
11-03-2005, 09:18 AM
i cant't find anything
here is the app. maybe you can find out why it is not working.

byte

Worm
11-03-2005, 09:35 AM
That's odd. Works fine here. Are you running the latest rev of AMS?

Byte
11-03-2005, 09:48 AM
yes i do.

but if it can't be fixed, i just leave it without the input mask

byte

Worm
11-03-2005, 02:42 PM
I don't know what to say, your app does work fine on my system here. There must be something else involved.