rivets icon indicating copy to clipboard operation
rivets copied to clipboard

value changes with rv-value do not trigger a change event

Open fsateler opened this issue 10 years ago • 3 comments

Hi,

When I set an input value via rivets, it does not emit a change event. This breaks external code that relies on regular javascript events.

See example jsfiddle. I'm not sure this is intended or not, but there should be a way to tell rivets to emit change events when it changes input values.

fsateler avatar Aug 15 '14 01:08 fsateler

+1 We just hit this as we implemented jvFloat to float labels above the input when the input has a value. The form loads and rivets binds the values, but no event is fired so jvFloat does not display the label now that the field has a value.

roryprimrose avatar Sep 12 '14 05:09 roryprimrose

My workaround for this issue is

var originalValueRoutine = rivets.binders.value.routine;

rivets.binders.value.routine = function (el, value) {
    var result = originalValueRoutine(el, value);

    // Raise a binding changed event
    $(el).trigger("bindingchange");

    return result;
};

I didn't want to raise the change event because I was worried about circular calls with the two-way binding.

roryprimrose avatar Sep 18 '14 05:09 roryprimrose

+1

ashok-v avatar Feb 24 '15 06:02 ashok-v