Message Box With OK-Cancel? - InfoPath Dev
in

InfoPath Dev

Message Box With OK-Cancel?

Last post 03-27-2006 12:20 PM by Stephanie Cantwell. 10 replies.
Page 1 of 1 (11 items)
Sort Posts: Previous Next
  • 03-27-2006 07:45 AM

    Message Box With OK-Cancel?

    I have a form that displays an information message box on form open. I need that message to have an OK/Cancel combination so that if, based on the instructional text, the user realizes they're in the wrong form, they can click Cancel. How might I accomplish that?

    Thank you!
  • 03-27-2006 08:22 AM In reply to

    Re: Message Box With OK-Cancel?

    Hi Deb,

    Try XDocument.UI.Confirm

    Here is the link
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipsdk/html/xdmthConfirm_HV01103972.asp
    Stephanie Cantwell / Test Manager
    Qdabra® Software / Streamline data gathering to turn process into knowledge

  • 03-27-2006 08:30 AM In reply to

    Re: Message Box With OK-Cancel?

    Thanks, Stephanie.

    Hmmm ... what do I attach that code to?
  • 03-27-2006 09:29 AM In reply to

    Re: Message Box With OK-Cancel?

    Here is the JScript code.

    function XDocument::OnLoad(eventObj)
    {
    // Write your code here
    var clicked;

    clicked = XDocument.UI.Confirm("Do you wish to continue?", 1);

    if (clicked == 1)
    {
    XDocument.UI.Alert("You clicked OK.");
    }

    else if (clicked == 2)
    {
    XDocument.UI.Alert("Your clicked cancel.");
    }

    }

    Although, if you probably should create a default view with those buttons.
    Stephanie Cantwell / Test Manager
    Qdabra® Software / Streamline data gathering to turn process into knowledge

  • 03-27-2006 10:34 AM In reply to

    Re: Message Box With OK-Cancel?

    OK. So far so good. Now how do I change the OK case to go on with the rest of the form and the CANCEL case to close InfoPath?

    BTW, this is way over my head. I'm just copying and pasting.;-)

    Deb
  • 03-27-2006 11:18 AM In reply to

    Re: Message Box With OK-Cancel?

    I was not able to use the Application.ActiveWindow.Close(true) function. I am not sure if that's because you can not call the it within onload or because of the form is not fully trusted. I will suggest you to do it with multiple views. You will have a confirmaiton view as a default view.

    This confirmation view will contain some text + two buttons, OK and Cancel.
    1. Set up a rule on the OK button for the following action:
    - switch view go to your data entry view.
    2. For the cancel button you will call the Application.ActiveWindow.close(true) inside the onclick function.
    Stephanie Cantwell / Test Manager
    Qdabra® Software / Streamline data gathering to turn process into knowledge

  • 03-27-2006 11:40 AM In reply to

    Re: Message Box With OK-Cancel?

    OK. I don't have any experience with Views, so I guess now is the time. I'll check back in as I progress. Thanks, Stephanie!
  • 03-27-2006 11:45 AM In reply to

    Re: Message Box With OK-Cancel?

    Wow. That was easy. I just have simple text on the screen with the two buttons. Any way to make it look more like a modal dialog?
  • 03-27-2006 12:15 PM In reply to

    Re: Message Box With OK-Cancel?

    For the life of me, that Application.ActiveWindow.close(true) code will not work. Is that the JS version? I get "object doesn't support this property".

    You helped me with this earlier last week and I went back to that form, but can't find where that code lives. It's not a Rule nor part of the Submit action.

    SOrry to be so dense. On a happy note, thank you for the View idea. Now that I've played around with them my imagination is going wild! ;-)
  • 03-27-2006 12:16 PM In reply to

    Re: Message Box With OK-Cancel?

    I don't really have an answer to that. You may just have to play around with it. Look at the sample forms for ideas and just make your information text looks professional.

    :-)
    Stephanie Cantwell / Test Manager
    Qdabra® Software / Streamline data gathering to turn process into knowledge

  • 03-27-2006 12:20 PM In reply to

    Re: Message Box With OK-Cancel?

    Try Application.ActiveWindow.Close(true). Close should be upper "C".
    Stephanie Cantwell / Test Manager
    Qdabra® Software / Streamline data gathering to turn process into knowledge

Page 1 of 1 (11 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.