2 Replies Latest reply on Jul 25, 2012 2:43 PM by JJBBDD

    Showing/Hiding annotation with onFocus/onBlur

    JJBBDD Level 1

      Hi-

       

      I'm having trouble using the onBlur and onFocus events in the same form field.

       

      I have an annotation that has these props when the document loads: What hidden=true and popupOpen=false

       

      On a form field, I've attached the following script to the onFocus event:

       

      var annot = this.getAnnot(0,'phoneTip');

      annot.setProps({

          hidden:false,

          popupOpen:true

      });

       

      This works fine when I don't have an onBlur event. (The annotation shows up when cursor enters field)...

       

      BUT, when I add the following script to the onBlur event, the annotation disappears and doesn't come back onFocus:

       

      var annot = this.getAnnot(0,'phoneTip');

      annot.setProps({

          hidden:true,

          popupOpen:false

      });

       

      What seems to be happening is the OnBlur event is firing right after the onFocus. When I dump the annot props above the set method in onBlur, I do see the correct values (hidden=false, popupOpen=true).. Maybe when I show the annotation, the annotation itself gets focus, and therefore the field loses focus and the onBlur event fires?)

       

      Does anyone know a workaround for this? Maybe a way to maintain focus on the form field?

       

      Thanks