linking Button to CustomJS for pure client-side interaction

I’m trying to build an “app” with purely client-side interactions, but I’m having trouble linking a Button to a CustomJS action. When I click the button, it causes a refresh of the page, and my CustomJS is never triggered (I’ve checked with simple console.log statements). My code basically looks like this:

text_input_1 = TextInput(value="", title=“schema.tablename”)

text_input_2 = TextInput(value="", title=“x”)

text_input_3 = TextInput(value="", title=“y”)

button = Button(label=“Go”, type=“success”)

button.on_click(btn_callback)

btn_callback.args[“text_input_1”] = text_input_1

btn_callback.args[“text_input_2”] = text_input_2

btn_callback.args[“text_input_3”] = text_input_3

left = figure(…)

right = figure(…)

show(vform(text_input_1, text_input_2, text_input_3, button, gridplot([[left, right]])))

Basically I’m using text inputs to make a form, but I only want to trigger an action when the user clicks the button. btn_callback is a CustomJS. I’ve used this kind of hacky form submission with multiple text inputs successfully with sliders, but for some reason can’t get the Button to trigger the CustomJS (and not do a page reload).

Any suggestion?

Michelangelo

That’s was a bug, that has been fixed in master:

https://github.com/bokeh/bokeh/issues/389

You might try an (unstable) Development build, or else the next release is nominally planned for the end of May.

Thanks,

Bryan

···

On Apr 26, 2016, at 17:57, [email protected] wrote:

I’m trying to build an “app” with purely client-side interactions, but I’m having trouble linking a Button to a CustomJS action. When I click the button, it causes a refresh of the page, and my CustomJS is never triggered (I’ve checked with simple console.log statements). My code basically looks like this:

text_input_1 = TextInput(value=“”, title=“schema.tablename”)

text_input_2 = TextInput(value=“”, title=“x”)

text_input_3 = TextInput(value=“”, title=“y”)

button = Button(label=“Go”, type=“success”)

button.on_click(btn_callback)

btn_callback.args[“text_input_1”] = text_input_1

btn_callback.args[“text_input_2”] = text_input_2

btn_callback.args[“text_input_3”] = text_input_3

left = figure(…)

right = figure(…)

show(vform(text_input_1, text_input_2, text_input_3, button, gridplot([[left, right]])))

Basically I’m using text inputs to make a form, but I only want to trigger an action when the user clicks the button. btn_callback is a CustomJS. I’ve used this kind of hacky form submission with multiple text inputs successfully with sliders, but for some reason can’t get the Button to trigger the CustomJS (and not do a page reload).

Any suggestion?

Michelangelo

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/6a61a8e0-f3df-48dd-af2c-78d0c82f3485%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Doh! Sorry for not searching the GH issues first. I’ll try master.

Thanks!

Michelangelo

···

On Tuesday, April 26, 2016 at 6:28:27 PM UTC-5, Bryan Van de ven wrote:

That’s was a bug, that has been fixed in master:

https://github.com/bokeh/bokeh/issues/389

You might try an (unstable) Development build, or else the next release is nominally planned for the end of May.

Thanks,

Bryan

On Apr 26, 2016, at 17:57, [email protected] wrote:

I’m trying to build an “app” with purely client-side interactions, but I’m having trouble linking a Button to a CustomJS action. When I click the button, it causes a refresh of the page, and my CustomJS is never triggered (I’ve checked with simple console.log statements). My code basically looks like this:

text_input_1 = TextInput(value=“”, title=“schema.tablename”)

text_input_2 = TextInput(value=“”, title=“x”)

text_input_3 = TextInput(value=“”, title=“y”)

button = Button(label=“Go”, type=“success”)

button.on_click(btn_callback)

btn_callback.args[“text_input_1”] = text_input_1

btn_callback.args[“text_input_2”] = text_input_2

btn_callback.args[“text_input_3”] = text_input_3

left = figure(…)

right = figure(…)

show(vform(text_input_1, text_input_2, text_input_3, button, gridplot([[left, right]])))

Basically I’m using text inputs to make a form, but I only want to trigger an action when the user clicks the button. btn_callback is a CustomJS. I’ve used this kind of hacky form submission with multiple text inputs successfully with sliders, but for some reason can’t get the Button to trigger the CustomJS (and not do a page reload).

Any suggestion?

Michelangelo

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/6a61a8e0-f3df-48dd-af2c-78d0c82f3485%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.