[4.0.4] When should onchange events run?

Posted by Meryk on 23-Dec-2015 10:06

Hello,

On change events on lookup fields seem to be running no matter if the value changes or not, i.e : if I have a value val1 in a lookup field A, and open the selector again and select the same value val1, then it will run all onchange events we have on field A.

I didn't try with all type of fields, but wioth a text field for example, the on change event is running only when the value of the text actually changes (previous value != current value), and not each time we typing something in the field.

Is that a specific behavior to lookups? Because we think on change events should only run when values change ...

Thanks,

Meryem

Posted by Mohammed Siraj on 23-Dec-2015 23:30

Meryem, Lookup selector field is a composite control (i.e. kendo picklist & associated selector buttons) & such behavior is expected as we are always resetting the value on returning from selector dialog.

With Rollbase 4.0.5 release, we are going to add fieldContext.hasValueChanged() interface method. You can leverage this within the onchange handlers to identify whether a field value has actually changed or not.

All Replies

Posted by Mohammed Siraj on 23-Dec-2015 23:30

Meryem, Lookup selector field is a composite control (i.e. kendo picklist & associated selector buttons) & such behavior is expected as we are always resetting the value on returning from selector dialog.

With Rollbase 4.0.5 release, we are going to add fieldContext.hasValueChanged() interface method. You can leverage this within the onchange handlers to identify whether a field value has actually changed or not.

Posted by Meryk on 24-Dec-2015 03:42

Hi Siraj,

Ok I understand. The hasValueChanged() method is a nice one to have. Thank you :)

But what about other fields (not lookups) ?

Thanks

Meryem

Posted by Mohammed Siraj on 24-Dec-2015 08:15

If you are enquiring about whether other fields will also have the same interface method i.e.  hasValueChanged(), answer is YES.

But as you stated earlier, do not think this should be an issue with other fields.

Posted by HosnyA on 06-Jan-2016 04:35

Hello Siraj,

I would expect all fields to behave the same. i.e. The on-change event to fire on all fields when the value has changed regardless of it being a look-up, pick-list or a text field. This behavior doesn't look uniform across Rollbase.

cheers,

Hosny

This thread is closed