ReadOnly Questions - InfoPath Dev
in

InfoPath Dev

ReadOnly Questions

Last post 02-03-2010 10:53 AM by zxkuqyb. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 08-18-2009 02:37 AM

    ReadOnly Questions

    Hi Guys :D

    just a bunch of question which i am sure this will be no deal for you to answer. All Questions referring to Code Behind in C#.

    1.) How to indicate if the current opened Form is in "Read Only" mode? For example if the user hasnt the permission to save the form with any kind of edits.

    2.) As all of you should know, you can add a Additional View in your InfoPath Form. Usually used as Print View. And you can configure this View to be "Read Only", so if someone Switch to this View (which can also be deactivated) he cant edit anything. Is it possible to set this kind of "Feature" to any View with Code? My Idea is to change all Views to "Read Only" if the File itself is in "Read Only" Mode - so the user cant change anything and dont wonder why he cant save it.

    3.) If 2.) isnt possible, how to prevent the following Situation - A User open the Form which File is in Read Only Mode. (due insufficiant permissions).

    - The User is changing a Textfield
    - He cant Save the File, so he press the X - to close the Window.
    - THEN InfoPath ask's him if he want to save the File, if he Press YES it will be saved ... as new File with a new Filename (as generated in the submit Rule). I must prevent this! 

    But how to prevent it? I read something about a OnSaveEvent or something like This as EventHandle, but how to Add this EventHandle to my Code? Thanks a lot for your tipps :) Im also happy if someone throw me a brik on my head - with some links to other Topics or/and other pages.

  • 08-18-2009 08:14 AM In reply to

    Hi --

    To prevent the 'save' prompt when the user clicks the red x, simply set the form template to not allow Save or Save As -- you'll find this option under Tools / Form Options / Open and Save.

    As to the read only -- I think you'll need to create a view that is set to Read Only and switch to that in open rules (or in the form's loading event, if you prefer code) based on user roles. Ummmm.... as far as your statement "you can add a Additional View in your InfoPath Form. Usually used as Print View", just so you know, there are a lot of reasons to add different views to your form, printing would be just one option.

    Hilary Stoupa

  • 10-06-2009 04:03 AM In reply to

    Sorry my VERY late answer ^^ Indeed this would be a option, to switch to a ReadOnly view to prevent that a user could change something in the Form and gets the Save Promt. But doesnt this mean something has changed in the Formular already? My first Problem is; where can i get the information in my Code Behind / or even directly in the Form, that the Form is currently opened in "Read Only" mode ? My second Problem: Those Save / Save As Buttons are already deactivated (under Tools / Form Optionts / Open and Save) as you mentioned, but if the User changes a "Read Only" Formular it sill askes him, while he close the Form, if he want save those changes. If he say yes a new Formular will be created in my Document Library as copy of the "Read Only" Formular, but with those made changes. Thats something which must be also prevented! And therefore i see only the chance to switch to a Read Only View, if the Form was opened in Read Only Mode.
  • 10-06-2009 07:43 PM In reply to

    user cannot edit a read only view so you dont need to be concerned about that

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 10-07-2009 01:00 AM In reply to

    Okay ;) but i still need to know if the Form was opened in Read Only State to switch to the Read Only view to dont let the User make changes at the form :)
  • 10-07-2009 05:56 AM In reply to

    Found it myself :) this.ReadOnly - Attribute, tell me if the Form was opened in Read Only State. Also its possible to change the View whithin the FormsEvent_Loading - Event with: e.SetDefaultView("NAME");
  • 02-03-2010 10:53 AM In reply to

    • zxkuqyb
    • Not Ranked
      Male
    • Joined on 01-14-2009
    • Indianapolis, IN
    • Posts 18

    I use this...

    if (XDocument.IsReadOnly)
      {
       XDocument.UI.Alert("The form cannot be modified.  Please try again later.");
       return;
      }

     

    *****What I'd like to figure out is to throw a message to the user that shows the Current User Name of who has the 'Original' Form opened in Edit Mode...that's the mystery.  Anyone have an idea?

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