Searchbar v2 onSubmit in ios theme


#1

Hello,

i trying to access the searchbar in my component.
i´m using subnavbar/searchbar.

in the md theme i get a submit-event on ios theme i dont get a event.

   $$(e.target).find('.searchbar').submit(function(){
          //do stuff e.g with $$(e.target).find('.searchInput').val().trim();
   });

#2

For submit event to work correctly it must have input type=submit


#3

how can i catch the event on “search” (not on typing what on:search in app.searchbar.create does)

in the old version i could do this on both themes with .submit(function…)


#4

It is recommended to use callbacks for that like onSearch, onClear, etc. http://framework7.io/docs/searchbar.html#search-bar-parameters


#5

yeah but there we missing an important callback.

for example look at the gmail app:
you can search there your whole mailbox. but he only searches after you press the icon on the corner.
that is made because this search is such a heavy operation you dont wanna do this on type.
we also have an api-search which we wanna trigger only on submit.
(in the 1.* version submit works)

here is a screen when the gmail app begins to search “heavy”


#6

Then, just enable customSearch: true in searchbar settings, add <input type="submit"> in searchbar form and handle all events manually, e.g. $('form.searchbar').on('submit', ...)


#7

hello,

i found the “problem”

$$(e.target).find('form.searchbar').on('submit', function()

dont work

$$('form.searchbar').on('submit', function()

works.

(because searchbar is not part of page in ios theme :blush:)