NetTalk Central

Author Topic: Override the default first field focus on opening  (Read 3938 times)

CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Override the default first field focus on opening
« on: October 27, 2018, 04:21:29 PM »
Hi Bruce

How do I override the default first field focus on opening?  You dealt with this a few years ago, but I thing the templates have changed since.  My particular problem is a memory form that receives user parameters then is recalled to display output on a tab below the parameters.  I want to use scrollToView to display the output in small mobile screens, but the scroll is pulled back up to make first field.

I can use:

p_web.SetValue('SelectField',clip(loc:formname)&'.'&p_web.NoColon('MyDesiredField'))
p_web._SelectField()

to get $('#MyDesiredField).focus()  but the script is appears to be overriden by the $('#MyFirstField).focus() at the bottom of the scripts.  Putting the p_web.SetValue into PreUpdate didn't fix the problem.   AutoFocus is turned off on the Advanced Tab.  Any thoughts on where to put the code?

For my particular problem, I noticed the modified example app web2 does not scroll back to the first field even though the firstfield.focus is at the bottom of the scripts,  so there may be another way besides removing focus to achieve a sticky scrollToView.

Thanks so much.