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

html:bidir-value update on input only triggered when hitting return #15

Open
mojo2012 opened this issue Jan 24, 2019 · 3 comments
Open

Comments

@mojo2012
Copy link

mojo2012 commented Jan 24, 2019

I wanted to bind a value of an input to a field in my view. First I though this should work:

<input type="search" class="top-searchbox" placeholder="Search ..." html:bidir-value="searchInput">

But the value is only updated when I hit "return" (same as the real html change event).

I solved this using this html:

<input type="search" class="top-searchbox" placeholder="Search ..." html:value="searchInput" event:keyup="onKeyUpSearchInput(it)">

Together with this java code:

public void onKeyUpSearchInput(KeyboardEvent e) {
	this.searchInput = ((HTMLInputElement) e.getTarget()).getValue();
}

But it would be nice if the html:change or the html:bidir-value would do exactly that -> update the value on change not just after hitting return.

@mojo2012
Copy link
Author

Probably having a html:bidir-value-live as suggested in TeaVM/issue 376 would be a nice solution?

@konsoletyper
Copy link
Owner

There are many ways to treat 'anything got changed'. First, you have many events (not only keyup) that can affect content of a text field. For example, you can select a portion of text and remove it using context menu, you can paste text from clipboard, etc. Second, reacting on every little change in some cases might be an overhead, so user may want to get change events afer some delay. Since there are plenty of different cases with different requirements, I decided not to trying to support them all in core framework. A user can create its own component (see documentation) which behaves exactly as expected. I would extend Flavour to support more different cases of changing, but I don't like quick and dirty solutions, a framework must be flexible enough. So I need first to think about this, analyze different use cases, look how other frameworks (Angular, React) handle this, etc. Unfortunately, not in near future. Frankly speaking, I don't have time to support Flavour, and I rarely fix critical bugs. I'm focused on pure TeaVM now, sorry.

@mojo2012
Copy link
Author

Ok good to know that is kinda unmaintained. I'm currently investigating what technology to use for my ecommerce storefront. I liked flavour, but I'm probably going for my own UI toolkit (https://github.com/mojo2012/jfly, just in case your wondering).

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

2 participants