Open renatoathaydes opened 1 year ago
A workaround for this is to define the onKeyUp()
function after the declaration of the input
tag, e.g.
val input = input {
placeholder = "Text to encode to base58"
}
input.onkeyup = { _ ->
byId(base58Result).textContent = input.value
asDynamic()
}
@e5l some input on this would be worthwhile, because I'm not sure how to reconcile the fact that the input
object within the builder block isn't the actual input
object within the DOM - and thus, you're not getting the actual value
field within the DOM object when you invoke value
within the builder block - without some considerable refactoring.
@severn-everett, yep we can't make it without refactoring. Could you tell me if you have an idea on how to do that?
As workaround we can try introducing some property (like input { domItem.value }
) which will be resolved to actual dom item when it called. It also can cause error if the element is not initialized yet, so we need to check
It might be worth updating the onEvent
callback signature in this codebase so that the actual DOM object gets passed in as well, so the user could then do something like:
input {
placeholder = "Text to encode to base58"
onKeyUpFunction = { inputDOM, _ ->
byId(HtmlIds.base58Result).textContent = inputDOM.value
}
}
Not the prettiest, but at least it'd minimize the amount of code that would need to get shuffled around behind the scenes.
Got the following error trying to get the
value
of aninput
:Code: