Open another form using if else condition - InfoPath Dev
in

InfoPath Dev

Open another form using if else condition

Last post 10-03-2006 09:32 AM by Matt Faus. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 09-26-2006 04:55 PM

    Open another form using if else condition



    Can someone see if you can duplicate my problem by creating
    two separate forms? Add business_card_order (boolean) field to Form1. Next, create a button on form1 and type your if and else statement to open form2 if the
    value of business_card_order is equal to "Yes" else do something else.

    The code below runs without error but it won't open the business card form when the business_card_order field value was set to either yes or no. I hope this is not a bug.

    ---------------------------------------------------------------

    var sourceBusinessCard = XDocument.DOM.selectSingleNode("//my:myFields/my:business_card_order").text;

    if (XDocument.DOM.selectSingleNode("//my:myFields/my:business_card_order").text == "Yes")
    {
    //open business card order form template
    var xBusCard = Application.XDocuments.NewFromSolution("\\\\everest\\public\\forms\\Infopath Business Card Order Form.xsn");

    else
    {
    email the new hire form bunch of codes
    }
  • 09-26-2006 05:43 PM In reply to

    Re: Open another form using if else condition

    Sorry, the field is not boolean but string.
  • 10-03-2006 09:32 AM In reply to

    Re: Open another form using if else condition

    By looking at the code, this looks like it should work. To help you debug, you might want put in a few popup dialogs that show you the values that you are working with. Another consideration would be making sure the case sensitivity is not throwing you off. Also, you are not using the sourceBusinessCard variable anywhere, try this:




    var sourceBusinessCard = XDocument.DOM.selectSingleNode("//my:myFields/my:business_card_order").text;

    XDocument.UI.Alert( sourceBusinessCard );

    if (sourceBusinessCard.ToUpper() == "YES")
    {
    //open business card order form template
    var xBusCard = Application.XDocuments.NewFromSolution("\\\\everest\\public\\forms\\Infopath Business Card Order Form.xsn");

    else
    {
    email the new hire form bunch of codes
    }
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.