When I press enter it works great. However I also want to perform search by clicking the searchbutton in the text box. I added oncommand attribute, it performed the search however after search ended, searchbutton changed into a cross. I clicked the cross it performed the search again. I checked the documentation however could not find any information about how to associate my searchbutton click with search event.
<textbox id="txt1" type="search" searchbutton="true" editable="true"
onkeypress="keyHandler(event);" />
First a side-note: Do not process clicks or key presses directly, always use the
commandevent – this makes sure the behavior of the element is consistent with what the user expects.<textbox type="search">assumes that performing the same search twice makes no sense. So after performing the search the search button changes into a cross, clicking that cross clears the search text (and triggers a newcommandevent of course). If instead of clicking the cross you change the search text you will get the usual search button again. So yourcommandhandler should look at the search text: show default results if the text is empty (search text cleared either manually or by pressing the cross) and perform a new search if the text is non-empty.