0
votes

I'm new with Sharepoint. I have a form and I edit it with Sharepoint designer. I would like to disable a drop-down list (I want just show the value without the possibility to change it). I don't know exactly how to do that directly in the code of the Sharepoint field?

Here my field:

            <tr class="UniqueKeyMasterContract">
                <td width="190px" valign="top" class="ms-formlabel">
                    <H3 class="ms-standardheader">
                        <nobr>UniqueKey</nobr>
                    </H3>
                </td>
                <td width="400px" valign="top" class="ms-formbody">
                    <SharePoint:FormField runat="server" id="ff1{$Pos}" ControlMode="New" FieldName="UniqueKeyMasterContract" __designer:bind="{ddwrt:DataBind('i',concat('ff1',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@UniqueKeyMasterContract')}"/>
                    <SharePoint:FieldDescription runat="server" id="ff1description{$Pos}" FieldName="UniqueKeyMasterContract" ControlMode="New"/>
                </td>
            </tr>

Could you please help me with that ?

1

1 Answers

0
votes

You could add a script editor in the form page, and add the following code to the script editor web part.

    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>

<script>

$(function () {
  $('select[title="Choice"]').change(
    function(){
      this.selectedIndex=this.defaultIndex;
    }
  )
 
})
</script>

enter image description here

Tip: Pay attention to modify the jQuery selector.