You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Kerri Shotts (JIRA)" <ji...@apache.org> on 2016/12/14 16:13:58 UTC

[jira] [Commented] (CB-12248) navigator.notification.confirm callback doesn't return an index but a boolean

    [ https://issues.apache.org/jira/browse/CB-12248?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15748734#comment-15748734 ] 

Kerri Shotts commented on CB-12248:
-----------------------------------

Edited to make code easier to read.

Also: what version of the Dialogs plugin are you using?

> navigator.notification.confirm callback doesn't return an index but a boolean
> -----------------------------------------------------------------------------
>
>                 Key: CB-12248
>                 URL: https://issues.apache.org/jira/browse/CB-12248
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin Dialogs
>    Affects Versions: cordova-cli@6.4.0
>         Environment: OS: Ubuntu_16_LTS x86_64,  Kernel Version: 4.4.0-31-generic, Browser: Google Chrome 54.0.2840.71 (stable), Framework: MobileFirst 8, Platform: IOS 4.3.0
>            Reporter: Alessandro Pasi
>            Priority: Minor
>              Labels: ios4
>
> Since the buttonIndex should return an integer, the following code should be working but the default case is always fired:
> {code:javascript}
>     navigator.notification.confirm("Description",
>         function (buttonIndex) {
>             switch(buttonIndex){
>                 case:1
>                     //do something
>                     break;
>                 default:
>                     //do something
>             }
>         }
>     }, "Title", ["OK", "Cancel"]);
> {code}
> A little inspection reveal that the confirm method is returning a boolean instead of a number. The following code is working:
> {code:javascript}
>     navigator.notification.confirm("Description",
>         function (buttonIndex) {
>             if(buttonIndex){
>                 //do something
>             }else{
>                 //do something
>             }
>         }
>     }, "Title", ["OK", "Cancel"]);
> {code}
> The documentation states "The callback takes the argument buttonIndex (Number), which is the index of the pressed button. Note that the index uses one-based indexing, so the value is 1, 2, 3, etc." and it should be changed accordingly.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org