rivets
rivets copied to clipboard
value changes with rv-value do not trigger a change event
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.
+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.
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.
+1