Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Need a workaround for selectOnFocus attribute not working exactly as expected

    Greetings,

    I have a form with a TextItem. I have the attribute selectOnFocus:true. When I tab to the field it works exactly as I expect. However, if I click on the field with the mouse, which is what the user will do, the entire field doesn't select. I can see why this would be the case, but I want it to autoselect the entire field when they click on it. I've tried to figure out a work around, but I've not had any success.

    A short hint or direction to go to will probably save me some time.

    Thanks,
    S

    #2
    It's not clear whether you actually want to do this (clicking with the mouse at a specific position is often a sign you want to edit at that position) but you can use setSelectionRange() to manually select all or part of the text when the focus event fires.

    Comment


      #3
      Thanks. Good point about selecting. The reason I'm wanting to do it is that this is a search field. The default value is "Enter ticker, name, NAIC code or group". So when they click on the field to search, I want that to select so it'll go away. And that search field is at the top of each page, so I think, in practice, it'll work the way I want. At least I hope.

      Thanks,
      S

      Comment


        #4
        Use hint and showHintInField instead to create that kind of interface.

        Comment


          #5
          Ah! Thanks! I really do read the docs. I spent a fair amount of time looking over the methods, but I missed that one.

          Comment

          Working...
          X