You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by ranjan sasmal <sa...@gmail.com> on 2018/04/19 16:42:00 UTC
Issues occured
Hi Sir,
please help me my issues . I can't understand why searchbutton is not
working on cordova app during search key pressed in android.
Below my code..............
<html>
<head>
<title>Search Button Example</title>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for device API libraries to load
//
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
// device APIs are available
//
function onDeviceReady() {
// Register the event listener
document.addEventListener("searchbutton", onSearchKeyDown, false);
}
// Handle the search button
//
function onSearchKeyDown() {
console.log('ok');
}
</script>
</head>
<body onload="onLoad()">
<input type="search" />
</body>
</html>
It should console ok msg . but it is not working why?
Thanks
Ranjan Sasmal.
Re: Issues occured
Posted by Florian Pechwitz <fl...@itizzimo.com>.
That's not a problem of Cordova, it's a problem of your posted code.
That's how you do it:
<html>
<head>
<title>Search Button Example</title>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for device API libraries to load
//
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
// device APIs are available
//
function onDeviceReady() {
// Register the event listener
document.getElementsByTagName("input")[0].addEventListener("click",
onSearchKeyDown, false);
/*Alternative and better way is adding the id attribute to the input like I
did (see the second input)
and then use the following code line:
document.getElementById("search").addEventListener("click",
onSearchKeyDown, false);
*/
}
// Handle the search button
//
function onSearchKeyDown() {
console.log('ok');
}
</script>
</head>
<body onload="onLoad()">
<input type="search" />
<input type="search" id="search" />
</body>
</html>
2018-04-19 20:46 GMT+02:00 Jesse <pu...@gmail.com>:
> Hi Ranjan,
>
> This list is for development of the cordova framework itself, and not
> really for user support.
>
> First steps, are maybe to try using an alert to make sure the button
> handler code is called, and also try a console.log in some code that you
> know is called and make sure it shows up. Then you at least should have a
> direction to look.
>
> After that, I suggest you search and/or post on stack-overflow.
>
> Cheers,
> Jesse
>
>
>
> @purplecabbage
> risingj.com
>
> On Thu, Apr 19, 2018 at 9:42 AM, ranjan sasmal <sa...@gmail.com>
> wrote:
>
> > Hi Sir,
> >
> > please help me my issues . I can't understand why searchbutton is not
> > working on cordova app during search key pressed in android.
> >
> > Below my code..............
> >
> > <html>
> > <head>
> > <title>Search Button Example</title>
> >
> > <script type="text/javascript" charset="utf-8"
> > src="cordova.js"></script>
> > <script type="text/javascript" charset="utf-8">
> >
> > // Wait for device API libraries to load
> > //
> > function onLoad() {
> > document.addEventListener("deviceready", onDeviceReady, false);
> > }
> >
> > // device APIs are available
> > //
> > function onDeviceReady() {
> > // Register the event listener
> > document.addEventListener("searchbutton", onSearchKeyDown,
> false);
> > }
> >
> > // Handle the search button
> > //
> > function onSearchKeyDown() {
> > console.log('ok');
> > }
> >
> > </script>
> > </head>
> > <body onload="onLoad()">
> > <input type="search" />
> > </body>
> > </html>
> >
> > It should console ok msg . but it is not working why?
> >
> > Thanks
> > Ranjan Sasmal.
> >
>
--
Herzliche Grüße / Kind Regards
Florian Pechwitz
Core Developer
E florian.pechwitz@itizzimo.com W www.itizzimo.com - www.simplifier.io
<https://www.linkedin.com/company/2979169>
<https://www.xing.com/companies/itizzimoag>
--
iTiZZiMO AG - Nürnberger Str. 47A - 97076 Würzburg - Germany
<https://maps.google.com/?q=N%C3%BCrnberger+Str.+47A+-+97076+W%C3%BCrzburg+-+Germany&entry=gmail&source=g>
Registered Office: Würzburg - Registered Court: Amtsgericht Würzburg, HRB
12879
Supervisory Board: Prof. Dr.-Ing. Volker Bräutigam (Chairman),
Matthias Weber, Michael Mühleck, Prof. Dr. Karl Liebstückel
Executive
Board: Reza Etemadian (Chairman), Christian Kleinschroth, Christopher
Bouveret, Florian Rühl
©2018 iTiZZiMO AG. This message and any attachments
including its content such as text, images, logos, graphics, videos are
property of iTiZZiMO AG, protected by german and international copyright
laws and must be treated strictly confidential. It may not - neither
completely nor partially - be changed, copied, reproduced, distributed or
made available to the public without the prior written consent of iTiZZiMO
AG or its subsidiaries.
Re: Issues occured
Posted by Jesse <pu...@gmail.com>.
Hi Ranjan,
This list is for development of the cordova framework itself, and not
really for user support.
First steps, are maybe to try using an alert to make sure the button
handler code is called, and also try a console.log in some code that you
know is called and make sure it shows up. Then you at least should have a
direction to look.
After that, I suggest you search and/or post on stack-overflow.
Cheers,
Jesse
@purplecabbage
risingj.com
On Thu, Apr 19, 2018 at 9:42 AM, ranjan sasmal <sa...@gmail.com>
wrote:
> Hi Sir,
>
> please help me my issues . I can't understand why searchbutton is not
> working on cordova app during search key pressed in android.
>
> Below my code..............
>
> <html>
> <head>
> <title>Search Button Example</title>
>
> <script type="text/javascript" charset="utf-8"
> src="cordova.js"></script>
> <script type="text/javascript" charset="utf-8">
>
> // Wait for device API libraries to load
> //
> function onLoad() {
> document.addEventListener("deviceready", onDeviceReady, false);
> }
>
> // device APIs are available
> //
> function onDeviceReady() {
> // Register the event listener
> document.addEventListener("searchbutton", onSearchKeyDown, false);
> }
>
> // Handle the search button
> //
> function onSearchKeyDown() {
> console.log('ok');
> }
>
> </script>
> </head>
> <body onload="onLoad()">
> <input type="search" />
> </body>
> </html>
>
> It should console ok msg . but it is not working why?
>
> Thanks
> Ranjan Sasmal.
>
Re: Issues occured
Posted by Rabindra Nayak <ra...@gmail.com>.
I would suggest look at phonegap Apis.From PhoneGap.com I am not sure this
working now days.
Install a JavaScript code editor.like Visual code for syntax error.
Check and debug by chrome inspect .
Check event handler Apis from phonegap api and check argument you passing
and api written.
Post this kind of question on other forum.We can help but in other forum.
On Fri, Apr 20, 2018, 00:09 ranjan sasmal <sa...@gmail.com> wrote:
> Hi Sir,
>
> please help me my issues . I can't understand why searchbutton is not
> working on cordova app during search key pressed in android.
>
> Below my code..............
>
> <html>
> <head>
> <title>Search Button Example</title>
>
> <script type="text/javascript" charset="utf-8"
> src="cordova.js"></script>
> <script type="text/javascript" charset="utf-8">
>
> // Wait for device API libraries to load
> //
> function onLoad() {
> document.addEventListener("deviceready", onDeviceReady, false);
> }
>
> // device APIs are available
> //
> function onDeviceReady() {
> // Register the event listener
> document.addEventListener("searchbutton", onSearchKeyDown, false);
> }
>
> // Handle the search button
> //
> function onSearchKeyDown() {
> console.log('ok');
> }
>
> </script>
> </head>
> <body onload="onLoad()">
> <input type="search" />
> </body>
> </html>
>
> It should console ok msg . but it is not working why?
>
> Thanks
> Ranjan Sasmal.
>