Simple way to determine if your form is running in filler(preview) or as web page. - infopath 2010 - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Simple way to determine if your form is running in filler(preview) or as web page. - infopath 2010

Last post 07-06-2016 08:01 AM by Hilary Stoupa. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 07-06-2016 07:49 AM

    Simple way to determine if your form is running in filler(preview) or as web page. - infopath 2010

    There are many times one may want to determine if their form is being viewed in Filler or in a browser to turn on or not turn on some feature based on that option.

    I often use it to submit form lock information to a library if it's in a browser, or not save lock info if I am working on the form and previewing it as I work.

    To do this, this is what I do: (This does not require any code or third party plugin.)

    1. Create an "isBrowser" boolean (TF) field.
    2.  Add a new rule in "Form Load." (I name it "isBrowser" and I make it the first rule in "Form Load.")
    3. In "Condition" add a new condition.
       a. Click "The expression" in the dropdown.
       b. Add:"xdEnvironment:IsBrowser() = true()" in the text area.
       c. Click "OK."
    4. Add an action by clicking the "Add" dropdown and select "Set a fields value."
       a. In the "Field" area, click the 'tree' icon to open the "Select a Field or Group" dialog.
       b. Choose your new field, "isBrowser" and set the default setting to "False" if it isn't already.
       c. Click "OK."
       d. Then click on the FX button in the "Value" area.
       e. Click on the "Insert Function" button.
       f. Then click on "All" in the "Categories" area.
       g. Under the "Functions" area, scroll almost all the way down, and click on "true."
       h. Click on "OK."
       I.  Click on "OK" again.
       j. And click on "OK" once more.

    Save your work.

    Now, from now on, whenever your form is opened in "Reader," the "isBrowser" field will be false. But when it is opened in a browser, it will be "true."

    I believe you can do the same thing for mobile use by using "xdEnvironment:IsMobile() and doing pretty much the same thing above.

    I admit I have not tested this for mobile use and would like an update as to what it does. 

    Hope this helps you. It is working just fine for me using either IE or Chrome. I haven't tested it with any other browsers.

    Kind Regards,

     

    Ray 

  • 07-06-2016 08:01 AM In reply to

    Re: Simple way to determine if your form is running in filler(preview) or as web page. - infopath 2010

    So cool - thanks so much for sharing this, Ray!
    Hilary Stoupa

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