PDA

View Full Version : How to create textfield as a menu item for a toolbar?



netskie
11 May 2007, 1:03 PM
How to create textfield as a menu item for a toolbar?

This serves as a search form..pls help.


thanx

genius551v
11 May 2007, 1:37 PM
Hi,

maybe you can do this (basic javascript style):


tb.addText('Search:');

var inputsearch = document.createElement("input");
inputsearch.setAttribute("type","text");
inputsearch.setAttribute("name","tb-input-search");
inputsearch.setAttribute("id","tb-input-search");
inputsearch.setAttribute("maxlength","100");
inputsearch.setAttribute("size","20");
inputsearch.setAttribute("className","input");

tb.add(inputsearch); //just add el


or (ext style :D ):


tb.addText('Search:');

var texfield = new Ext.form.TextField(); //you can put some config in there {...}

tb.addField(texfield);


or just (put html...:">)


tb.addText('<b>Search:</b><input type="text" name="textfield">');


or too I-|:


var textfield = Ext.get('mytextfield'); //textfield in your html pag
tb.addElement(textfield);


any way you can learn more if you read some like this:

about textfield and form elements (http://extjs.com/deploy/ext/docs/output/Ext.form.TextField.html)

about toolbar (http://extjs.com/deploy/ext/docs/output/Ext.Toolbar.html)

here these guys put a combobox in a toolbar, checkout... (http://extjs.com/deploy/ext/examples/menu/menus.html)