Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for programmatically modified values? #11

Open
twanlass opened this issue Sep 28, 2015 · 7 comments
Open

Support for programmatically modified values? #11

twanlass opened this issue Sep 28, 2015 · 7 comments

Comments

@twanlass
Copy link

For example, why doesn't this work?
https://jsfiddle.net/k25zfbm7/

@remy
Copy link
Owner

remy commented Sep 28, 2015

Not sure I follow - the subject suggests there's a problem with input[type=hidden], but there isn't one...

@twanlass twanlass changed the title Support for hidden inputs? Support for programmatically modified values? Sep 28, 2015
@twanlass
Copy link
Author

@remy my apologies - fixed the title, forgot to save.

Re: the jsfiddle above - wondering what I'm doing wrong or if this functionality is not implemented. I've got a few places where the input values are modified via jQuery et el but not seeing the binding update (no callback fired when changed etc).

Cheers!

-t

@AVGP
Copy link

AVGP commented Oct 2, 2015

I see a use case for that, when bind.js is used in a larger application, but you could still set the value programmatically in your example:

Instead of $('.name').val('tyler'); you use names.name = 'tyler'; instead.

@remy
Copy link
Owner

remy commented Oct 2, 2015

Oh, I think I follow now. Are you expecting the bound object to update when you change the input using jQuery?

If that's the case, I'm pretty sure you want to trigger a change event on the input element, since that's how bind.js is picking up the change.

$('input.name').val('tyler').trigger('change');

@remy
Copy link
Owner

remy commented Oct 3, 2015

@twanlass did that work?

@twanlass
Copy link
Author

twanlass commented Oct 3, 2015

@remy - calling trigger('change') doesn't appear to, no.

@adelriosantiago
Copy link

trigger('change') doesn't do the trick, any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants