Custom Button working only once

Any way to make button work everytime it is clicked ??


it prints only one time but should be on every time it is clicked

i managed to perform action on every click but still i’m using frappe.require and it is only working for the first time on button click

why not use frappe.add_custom_button

i am using select2 library for multi select option . It is only working for the first time not after that untill i refresh the page. Need to make it work on every click of button.

any way to make select2 library work on every time button is clicked without refreshing the page ?

Can you check this, is it related to yours?

NVM, got the solution of my problem.


Dear @nikzz you should share your solutions with others to get response from them in future.

// select2 library import here

var dialog = new frappe.ui.Dialog({
				fields: [
					{"fieldtype": "HTML", "fieldname":"data_button"},
					{'fieldname':'message','label': 'Message', 'fieldtype': 'Small Text',"reqd": 1,"placeholder":"Message"},
					{"fieldtype": "Button", "label":"Send", "fieldname": "update"}
var a=[12,34,66,7];

dialog.fields_dict.data_button.$wrapper.html('ID <select id=rec_id12 class="select2-container input-large form-control select2me" multiple=multiple style=width:100%> ');
  data: a

Problem with me was on second time, this field–> dialog.fields_dict.data_button.$wrapper.html('ID ') " was already there so there was problem when parsing through each line on second time it runs

1 Like