0 Replies Latest reply on Oct 12, 2011 7:34 PM by tjorvek

    Remove highlight from text after field.setFocus() - possible?

    tjorvek

      Howdy folks!

       

      I have some keystroke event JS on a field that wraps an unfinished word to a target field when the field is event.fieldFull

       

      This works, however when I set focus on the new field, the text is highlighted so you can't continue writing -  is there a way to remove the highlight and point the cursor at the end of the existing text after a field.setFocus() ?

       

      Here is how I am doing it, which is pretty basic (all the variables have been set outside the snip)

       

      <snip>

      nextField.value = nextText;

      nextField.setFocus();

      </snip>

       

      I have tried some non-acrojs methods for resolving this issue, but they don't seem to work, listed below...

       

      • nextField.setAction('OnFocus', 'this.value = this.value;');
      • nextField.setAction('OnFocus', 'this.getField(' + nextField.name + ').value = this.getField(' + nextField.name + ').value;');

       

      Help would be much appreciated, this is driving me nuts! 

       

      Thanks,

      tjor