NetTalk Central

Author Topic: Taming the cursor  (Read 3526 times)

Keith

  • Sr. Member
  • ****
  • Posts: 306
    • View Profile
    • Email
Taming the cursor
« on: January 16, 2015, 01:54:07 PM »
Hi

How can I define the next field to be accepted on a Form?

I have a Login Form and if a Code field is invalid I want to force the cursor back into the Code field after displaying an error message.

Specifically, I have three fields - Code, User and Password.  On entering Code (and say Tab) my Server Code detects and error and I post the error message but the cursor sits in the User field.  I would like to force it back to the Code field.

A secondary problem is that I would like to blank the fields in error but when I do this in the Server Code and 'Reset' the changed fields via the template the cursor goes into the aether (vanishes) and you can't type until re-establishing a field via a mouse click.

Is there anything I can do to get around this behaviour?

Thanks

Keith
Clarion 10.0.0 build 12799
NetTalk 9.31
StringTheory 2.65
InsightGraphing 2.27

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Taming the cursor
« Reply #1 on: January 22, 2015, 10:26:11 PM »
Loc:Invalid is set during validation to the field that you consider to be invalid, and hence the field that will regain the focus. So for example in example 3 the embed code reads;

    loc:invalid = 'Loc:Login'
    p_web.SetValue('retry','LoginForm')
    loc:Alert = 'Login Failed. Try Again.'


which will put the user back on the login field. But it could have been

    loc:invalid = 'Loc:Password'
    p_web.SetValue('retry','LoginForm')
    loc:Alert = 'Login Failed. Try Again.'


which would then put the user back on the password screen.

cheers
Bruce

Keith

  • Sr. Member
  • ****
  • Posts: 306
    • View Profile
    • Email
Re: Taming the cursor
« Reply #2 on: March 01, 2015, 11:57:53 PM »
This is an old thread but . . .

The code:

  loc:invalid = 'Loc:Login'
  p_web.SetValue('retry','LoginForm')
  loc:Alert = 'Login Failed. Try Again.'

works fine in the Login example app and is the template (as Bruce said above) for posting an error message, retrying the form and selecting the field on that form to continue with (the field in error).

I now have a Form (not a login Form) in which I check a field - CLI:Name and have the following code if the field is in error:

     loc:invalid = 'cli:name'
     p_web.SetValue('retry','u2clients')
     loc:Alert = 'Enter a valid Business Id'

which looks like the example but though the Alert message appears the cli:name field does not get the focus, the cursor remains in the next field.

Any ideas why this should be?

Thanks

Keith

Clarion 10.0.0 build 12799
NetTalk 9.31
StringTheory 2.65
InsightGraphing 2.27