HTML and CSS Reference
In-Depth Information
}
When a user focuses on the search field, if there is a search query in
the text box, you will want to show the current results to the user using
the deck utility.
var app = app || {};
app.controller = app.controller || {};
app.controller.movies = function(){
...
/**
* Binds the search form
*/
this.bindSearchForm = function(){
/**
* Here you add an event listener to the search filed using
* the focus event listener. If there's a value, then show the
* results.
*/
_searchfield.addEventListener('focus', function(){
if(this.value.length > 0){
app.utility.deck.showCard('card-movie_search_results');
}
});
}
...
}
The next event that you will need to bind is the submission of the form.
This is to prevent a user from accidentally pressing the go button on
the Android keyboard and submitting the form through the browser.
Instead, a search will be performed and the application will no longer
wait for the input timeout.
var app = app || {};
app.controller = app.controller || {};
app.controller.movies = function(){
...
/**
* Add an event listener to the submission of the form.
* This will prevent the form from being submitted
* and sent to another page. Instead, we capture the
* event and trigger the search action.
 
Search WWH ::




Custom Search