Programatically set a view to read only - InfoPath Dev
in

InfoPath Dev

Programatically set a view to read only

Last post 07-17-2010 04:12 PM by Skarn. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 04-08-2010 09:35 AM

    • emdc2
    • Not Ranked
    • Joined on 06-30-2009
    • Posts 7

    Programatically set a view to read only

    Is there a way to programatically set the readonly attribute of a view? I know you can do it through the view properties in the GUI, but I need to do it in code based on a status change (and I will be setting about 8 different views to readonly when the status changes). I do not want to make a copy of each view and set the copied set to readonly and then programatically change views based on a status change because I have 8 different (and very complex) views with tabs on the top and the left and the user still has to be able to navigate to all of the views in readonly. I don't want the overhead of having all of the extra views and have to manage the readonly vs readwrite in the navigation. I want to simply set all of the views to readonly in code when the status changes and set them all back to readwrite with another status change.

     Anyone ever set the readonly programatically? Is it possible?

  • 04-14-2010 12:53 AM In reply to

    Re: Programatically set a view to read only

    i dont think this is doable, you will have to create extra views or use conditional formatting. to set the controls on the view to readonly

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 04-14-2010 05:53 PM In reply to

    • emdc2
    • Not Ranked
    • Joined on 06-30-2009
    • Posts 7

    Re: Programatically set a view to read only

    That's the conclusion I came to too. Yuck. Lots of extra code!

  • 07-17-2010 04:12 PM In reply to

    • Skarn
    • Top 50 Contributor
      Male
    • Joined on 04-20-2008
    • Australia
    • Posts 198

    Re: Programatically set a view to read only

    I was able to do this using jScript - I'll get the code on Monday night. It works by using the change event of root level groups. Group change events get fired any time there is a change in one of their containing fields in the XDocument. I use a global variable which tells the event whether to allow the change to occur or reject it which a user message. If you can wait until Monday you might have a solution.

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