locked
how to change the infopath form Attachment control in readonly mode RRS feed

  • Question

  • hi,

    i want the attachment control to be read only view 

    but there is no option and also conditions,actions are not supported for this control

    does any one knows how to change it to readonly 

    i dont want to hide the control i just want the control to be readonly so that user can view it but cannot attach or delete it.

    Thanks,



    sal

    Wednesday, April 3, 2013 2:17 PM

Answers

  • Hi,

    Since you are using list form, the property will not be available for the attachment control. You can use JQuery to disable the attachment control. Add these code after the </Style> tag at the botton of the newifs.aspx in SharePoint designer. You need to change the id to the attachment link id on your page. You can get the id for the link with the help of developer tool of IE.

    <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
    
    <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
    
    <script type="text/javascript">
    
    $(document).ready(function () {
    
    setTimeout(function() {
    
    $("#ctl00_m_g_376e75f5_e897_4401_aa78_f538223f71ea_FormControl0_V1_I1_SPFAC2").attr("disabled","disabled");
    
    },1000);
    
    }); 
    
     </script>
    

    Thanks,

    Entan Ming


    Entan Ming
    TechNet Community Support

    • Marked as answer by Entan Ming Friday, April 12, 2013 2:03 AM
    Friday, April 5, 2013 3:55 AM
  • Hi,

    The attachment controls have different IDs, so you can use the JQuery code to disable one of the controls. Conditional Formatting rule is not available for attachment control in InfoPath designer.

    Thanks,

    Entan Ming


    Entan Ming
    TechNet Community Support

    • Marked as answer by Entan Ming Friday, April 12, 2013 2:03 AM
    Monday, April 8, 2013 7:13 AM

All replies

  • try with the permissions around the infopath form library, that should help you 

    http://www.sharepointlovers.com

    Wednesday, April 3, 2013 7:08 PM
  • Hi,

    In order to make a attachment control read only, you can try  the steps below:

    1. Open the form in InfoPath designer.
    2. Right click on the Attachment control and choose File Attachment properties.
    3. Uncheck 'Allow the user to browse, delete and replace files'.
    4. In this way this attachment control will be read only. You can also set a default file for the attachment control.

    Thanks,

    Entan Ming


    Entan Ming
    TechNet Community Support

    Thursday, April 4, 2013 4:57 AM
  • hi,

    i tried to check the attachment properties but there is no option for Allow the user to browse, delete and replace files

    if i right click the attachment control properties i can only see a advance tab.

    actually the attachment is linked to SharePoint list column may be that is why i cannot view the all properties of the attachment control

    FYI i am using sharepoint 2010 and infopath 2010

    Thanks


    sal

    Thursday, April 4, 2013 10:23 PM
  • Hi,

    Since you are using list form, the property will not be available for the attachment control. You can use JQuery to disable the attachment control. Add these code after the </Style> tag at the botton of the newifs.aspx in SharePoint designer. You need to change the id to the attachment link id on your page. You can get the id for the link with the help of developer tool of IE.

    <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
    
    <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
    
    <script type="text/javascript">
    
    $(document).ready(function () {
    
    setTimeout(function() {
    
    $("#ctl00_m_g_376e75f5_e897_4401_aa78_f538223f71ea_FormControl0_V1_I1_SPFAC2").attr("disabled","disabled");
    
    },1000);
    
    }); 
    
     </script>
    

    Thanks,

    Entan Ming


    Entan Ming
    TechNet Community Support

    • Marked as answer by Entan Ming Friday, April 12, 2013 2:03 AM
    Friday, April 5, 2013 3:55 AM
  • hi,

    i have created 3 views and i want the attachment control to make readonly in one of my view so if i am going to use this jquery it will make readonly in all the views 

    it there a way to use conditional formatting  for this attachment control

    Thanks


    sal

    Friday, April 5, 2013 11:49 AM
  • Hi,

    The attachment controls have different IDs, so you can use the JQuery code to disable one of the controls. Conditional Formatting rule is not available for attachment control in InfoPath designer.

    Thanks,

    Entan Ming


    Entan Ming
    TechNet Community Support

    • Marked as answer by Entan Ming Friday, April 12, 2013 2:03 AM
    Monday, April 8, 2013 7:13 AM