TextInput Value is not being fetched by javascript call back the TextAreaInput is working fine and it is displaying the entered value in console on Tab click.
But i need the to fetch the TextInput Value also. Please help!
from bokeh.layouts import layout, column
from bokeh.models.widgets import Div
from bokeh.io import show
from bokeh.models import TextInput, CustomJS, TextAreaInput
from bokeh.io import output_file
ti = TextInput(title="ti")
callback = CustomJS(code="""
var f=cb_obj.value;
console.log("hello ti");
console.log(f);""")
ti.js_on_change("value", callback)
tia = TextAreaInput(title="tia")
callback = CustomJS(code="""
var f=cb_obj.value;
console.log("hello tia");
console.log(f);""")
tia.js_on_change("value", callback)
doc_layout = layout()
doc_layout.children.append(column(Div(text="""<h1>Hello World!</h1>""")))
doc_layout.children.append(ti)
doc_layout.children.append(tia)
output_file('TestInput.html', mode='inline')
show(doc_layout)
Hi @SubhamSharma1996 please edit your post to use code formatting so that the code is intelligible (either with the </> icon on the editing toolbar, or triple backtick ``` fences around the code blocks)
Works just fine for me with Bokeh 2.0.2.
Note that js_on_change is triggered only when you hit Enter or when the input field loses focus. If you want to see updates for every key press then you should monitor the value_input attribute instead of value.