Strange behavior in form / text / onchange / onblur

edited August 2018 in Technical questions

Hi all,

..not able to reproduce in a small snippet, but my below basically rather simple code works weird:

return {view:"text", 
    name: oConfig.name,
    on:{ 'onAfterRender': function(id){ 

           //Somestuff, works OK

         }, 'onChange': function(newv, oldv){

                 //Somestuff, works sometimes

         }, 'onBlur':function(newv, oldv){ 

                 //Somestuff, works OK

      }
        } 
};

When I now change this text field in a form, I have 2 different behaviors:

  1. When changing and direct clicking into the next field, the onChange is actually never triggered, but onBlur is triggered

  2. When changing and clicking somewhere in the whitespace outside the form, the onChange is usually triggered (still not always, but most of the times) and also onBlur is triggered.

I have basically the same code for other combo's and others and there it works well. But also a similar issue with textarea.

Of course I can work around using onBlur and comparing changes to field values, but the actual onChange would be better ?

Anybody any thoughts ? Would be very much appreciated,

thanks a lot,

Frank

Comments

  • edited August 2018

    ..to extend on above - when changing the content of the text field and clicking directly into the next text field or jumping on with TAB, the onChange event is not triggered, but the Form.isDirty() does actually change from false to true. So you do have a correct change of isDirty, but no onChange event related to it.

    If you click after text field content change into the whitespace somewhere around, the onChange is usually (even not always) correct triggered and all works perfect fine :)

  • ..actually, even a bit more interesting:
    So when I enter a text in a form text field and jump with TAB to the next field:
    - IsDirty is set
    - onblur occurs
    - NO onChange occurs
    - Also the data seems not to be "really" saved, despite IsDirty and also getValue getting the correct value. If that form is now after entering text and tabbing away scrolled away and scrolled back in a carousel, the value will be gone and the field is empty.

    If I entered the text in the text field and clicked in whitespace outside the form. onChange will be triggered and the data will still be in the text field.

    A bit strange one, any thoughts appreciated.....

  • perhaps it would be better if you can create a snippet with such behavior.

  • Hi intregal,
    ..yes, as mentioned I wasn't able to reproduce in a small snippet, would probably be more complex, will see to somehow get it to a demonstrable version.....
    Frank

  • ...thanks Meera, yes, that would also be a good way to deal with it, thanks a lot...
    Frank

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!