How to control permission of inside form? RRS feed

  • Question

  • I have a form that customized through set ContentType Element FormUrls .It's consist of four parts.

    i want to respectively control its permission. For Example: user A only can edit first part. user B only can edit second part.

    The place where they can't editing will display as ReadOnly, no need hide.

    anybody knows , How to do this?

    Thanks in advance!

    Note: my form is not infopath form. So, I don't know the Permission Class whether available.

    Wednesday, May 23, 2012 6:16 AM


All replies

  • Hi!

    Usually this is done by placing code on the form that will set ControlMode property of Field control to Display based on some logic.  

    There is a solution on codeplex, which implements fields permission using this technique, but I guess it will not work with custom form (it uses its own custom form), but you can see how it is implemented:


    Wednesday, May 23, 2012 1:52 PM
  • Thanks for your reply! i have figured out this way. but it seems too much trouble.especially in situation of lots of Fields. Is there no way can control a section of the form?
    Thursday, May 24, 2012 3:18 AM
  • Out-of-box form is not devided into sections - it contains FieldIterator control, that render all fields consequentially. So if you want to control group of fields as one, you should implement our own controls, I can think of some container for field controls, which can propagate its control mode to children.
    Thursday, May 24, 2012 6:47 AM
  • But my forms were customized through adding <FormUrl> element to ContentType.
    Thursday, May 24, 2012 7:47 AM
  • I understand, but it is hard to propose something not seeing code. Can you post markup of your custom form pages?
    Thursday, May 24, 2012 7:54 AM
  • OK

    The whole page is consist of four "<FieldSet>" elements, is place of red markup in picture.

    each <FieldSet> contains several layer "DIV".

    I desired when one of parts is editable, others will be hide or Non-Editable

    Thursday, May 24, 2012 8:31 AM
  • Hi Linsen4624,

    About your requirement, here is a workaround of it:

    Use javascript to check which permission the current user has on page loaded. Then hide no permission fieldset(add id property on each fieldset).

    You can use SpServices to get current user:http://spservices.codeplex.com/releases/view/55660

    Javascipt hide fieldset:http://www.codingforums.com/showthread.php?t=113323

    Lhan han
    • Marked as answer by Lhan Han Tuesday, June 5, 2012 9:23 AM
    Tuesday, June 5, 2012 9:22 AM