PDA

View Full Version : TextArea Events (Change / OnChange???)



fcarriedos
26 Jan 2012, 3:42 AM
Hi there,

i am using a TextArea component that is being appended new text by the server side (no typing by the user and it is set to be readonly). Once the text within the component has overflown i would like it to scroll automatically to the bottom on every change, but i am unable to find the appropriate event on the listener declaration to trigger the scrolling code execution (btw such code works, i tested it with another event).

So, the point is, what event should i use??? My guess is something similar to change or onchange but not depending on key pressing and so on.

Thanks in advance!!!

Colin Alworth
27 Jan 2012, 12:13 PM
It is possible that neither is appropriate for you. The event Events.OnChange is fired when the dom onchange event occurs, meaning the user has blurred the field after having altered it, whereas the logic field event Events.Change is fired by the Field when it has been altered (usually after a dom event, but it is possible to also fire this from a call to field.setValue using setFireChangeEventOnSetValue(true)).

Both are intended to fire as the result of user interaction.

Without more info on your setup, my suggestion would be to either scroll to the bottom right after assigning a new value, or fire your own event when appending new data, and listen to that to perform the scrolling. If you are using the FieldBinding or FormBinding classes, you might be able to use the Events.Bind event to notice when new data has been bound, and react from there.