facebook

Popup Alert to "OK" button to take you to another screen?

πŸ’‘
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #335981 Reply

    fbod383
    Member

    OK, so I have a popup alert that notifies people of a legal disclaimer, there must be a way to change the JS to allow on click to go to another page instead of just closing the popup alert. I have tried a few different options, but I am just stabbing in the dark. I’ve found the action in my Main.JS just not sure where to go from there

    #335983

    Brandon
    Member

    Try this:

    
    var r=confirm("Press a button");
    if (r==true)
      {
      x="You pressed OK!";
    //or do something  
      }
    else
      {
      x="You pressed Cancel!";
    //or do something else
      }
      alert(x);
    
    #335987

    fbod383
    Member

    Thanks Brandon, but the code I have is like this… or am I even in the right area?

    ‘action15’:function() { setTimeout(function() { phoneui.alert(‘Alert: You have activated GRL Law’s Rights Reminder. If enabled, your phone voice recorder has also been activated to ensure any interaction between you and law enforcement is recorded to fully protect your rights. Keep your phone on your person if possible.’); }, 0);;}};

    #335988

    Brandon
    Member

    Sorry I misunderstood.

    Try the phoneui gotopage function.

    For some reason it wont let me type in the code…

    #335989

    fbod383
    Member

    I did that, but I must be putting it in the wrong spot, because it doesnt work. I assumed the 0 at the end was a end command, so I placed the function there but it just killed the whole screen.

    #335990

    Brandon
    Member

    Try right after this: possible.’); phoneui.goto page

    #335992

    fbod383
    Member

    that did the trick, thanks! Last question, and I saw something about this but didnt quite make sense of it.. how do I get the file location removed from the top of the popup box?

    #335993

    Brandon
    Member

    If I remember right I dont think its possible right now.

    #335994

    fbod383
    Member

    this is what I found earlier

    @support-wayne wrote:

    Hi Nigel,

    Following are 2 phoneui.js api that can be used in apps and webapps. The app context using the phonegap notification api which does not include the app URL. When used in a webapp the implementation falls back to standard javascript alert() and confirm() dialogs with the app url. In the jsdoc ‘TC’ refers to Test Center.

    
    /**
     * shows alert and calls fnContinue then. Note: works in different
     * ways in iOS and TC. For TC it returns immediately, while for iOS
     * it returns only when user pressed OK
     * 
     * @param message Text message
     * @param fnContinue function that called when user selected button.
     * @param optionalTitle optional, title for dialog
     * @param optionalButtonLabel optional, button label
     */
    phoneui.alert(message, fnContinue, optionalTitle, optionalButtonLabel)
    
    
    /**
     * shows confirmation dialog. result comes to fnContinue. Blocks in web app, doesn't block in
     * phonegap apps
     * 
     * @param message Text message
     * @param fnContinue function that called when user selected button. Takes 1-based index of selected button
     * @param optionalTitle optional, title for dialog
     * @param optionalButtonLabel optional, string with comma-separated button labels
     */
    phoneui.confirm(message, fnContinue, optionalTitle, optionalButtonLabel) {
    
    #335995

    Brandon
    Member

    Oh, I do rember seeing that using the phoneui, but I havent done anything with that, so Im not the best one. Hopefully Support or one of the people who have done more native apps can shed some light on how to use it better.

    #336014

    paulD
    Member

    Another way to do it would be use an image as the the alert pop up. You could have it hidden until you need it. So on user click, it shows the alert box image. On user clicking the alert image it would hide the alert image then fire a function to transit to another mobi page.

    That would be pretty easy to to implement with a css.visible or maybe toggle for the image. Then just fire a function with a phoneui.gotoPage()

    Thanks

    Paul

    #336026

    fbod383
    Member

    Great idea paul.. I am gonna play with that see which I like better

Viewing 12 posts - 1 through 12 (of 12 total)
Reply To: Popup Alert to "OK" button to take you to another screen?

You must be logged in to post in the forum log in