Popup on Toolbar InputButton

Hi,

I’m trying to use the popup on a InputButton on the toolbar.

What I want is to have an inputfield on the toolbar that when is typed inside a popup appears with the result of the search, here the part of code that should append the popup, but something is not working:

		myToolbar.attachEvent("onValueChange", function(id, value){
				myPop = new dhtmlXPopup({ toolbar: myToolbar, id: "search"});
				
				myPop.attachList("name,price", [
					{id: 1, name: "Audi A5 Coupe", price: "€ 31,550"},
					{id: 2, name: "Audi A5 Sportback", price: "€ 30,990"},
					myPop.separator,
					{id: 3, name: "Audi A6", price: "€ 30,990"},
					{id: 4, name: "Audi A6 Avant", price: "€ 37,450"},
					{id: 5, name: "Audi A6 Quattro", price: "€ 55,360"},
					myPop.separator,
					{id: 6, name: "Audi TT Coupe", price: "€ 29,830"},
					{id: 7, name: "Audi TT RS Coupe", price: "€ 59,800"}
				]);
		});

and here the inputButton from the xml file:

<item id="search" type="buttonInput" width="160"/>

If I simply try this code:

		myToolbar.attachEvent("onValueChange", function(id, value){
				alert(id+":"+value);
		});

it works greathly. Some solution?

Thanks in advance.

Please, try to call the:

  myPop.show("search")

after the popup initialization.
also, please, try to initialize your popup out of the onValueChange event to prevent creating multiple popup objects:
http://snippet.dhtmlx.com/5/dcd94cdf5

Wow, this is exactly what I tried to do. Fantastic, thank you.

And how could I append to the popup a < div > element and use the value inserted in the field to search a database?

The MySql and php part is clear, the only part that is not really clear is the javascript part for passing the value from the toolbar inputfield to the php.

You may attach any needed html-content to your popUp:
https://docs.dhtmlx.com/popup__attaching_content.html#attachinganhtmlstring
with any required custom logic

After some tests and some bad word the script is now working fine.

It’s possible to access an input field on the toolbar with a key combination (like CTRL+ALT+F)?

Ufortunately such feature is not supported.