Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

137
Views
Bohek CustomCS callback failed

I am using Bokeh to do a dashboard and I would like to create a confirm button when user press on the confirm button, the saveButton will appear. The disabled property of saveButton will change from true to false. I have tried it with the following code and it seems like I have made something wrong. Should I pass the button arguments to Javascript? I am not very familiar with javascript. Thank you for your help

confirmButton = Button(label="Confirm Your Change", button_type="success")

callback = """
if (confirm("Confirm Saving?")) {
    saveButton.disabled = false;}

""" 
confirmButton.js_on_event(ButtonClick, CustomJS(code=callback))

saveButton = Button(label="Save", button_type="success",disabled=True)
about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

If you want to activate the saveButton by one click (and this stays activated afterwards), simply create the two Buttons, use js_on_click() and pass as an argument the second button. Then you can set the disabled value to false.

confirmButton = Button(label="Confirm Your Change", button_type="success")
saveButton = Button(label="Save", button_type="success",disabled=True)
confirmButton.js_on_click(
    CustomJS(
        args=dict(saveButton = saveButton), 
        code="saveButton.disabled = false"
    )
)

If you want to toggle the status, use

code="saveButton.disabled = !saveButton.disabled"

inside the CustomJS function.

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!