Forum Discussion

cdempsey's avatar
cdempsey
New Contributor
11 years ago

Masked Zip Code field losses data after moving to next field on screen

Mask of the field is #####-####
It allows manually entry of 12345, 12345-6789

When use settext with either of those using automated script the field goes blank after the field losses focus.

Anyone have any thoughts?

3 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    It sounds like there is an OnExit event or something attached to the field.  SetText may not be properly entering the routines around the data field and so, when the OnExit event fires, it does not preserve the data.  This has been my experience in the past with similar issues.



    Does it work differently if you use "Keys" instead of "SetText"?

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    You could also make sure that you directly execute keys on the object if you call



    <objectname>.Keys(xxxxx-xxxx)



    The Keys method is part all recognized objects.  



    Either way, glad it worked for you.
  • cdempsey's avatar
    cdempsey
    New Contributor
    We found sys.keys("#####-####") works

    thanks for the input