0

How can I Disable input fields in forms through SharePoint Designer.enter image description here

0

Open the form in SharePoint Designer and go to the Code view.

On your Mentor Name field change the ControlMode attributes from "Edit" to 'Display". There should be 2 occurrences:

<SharePoint:FormField runat="server" id="ff1{$Pos}" ControlMode="Display" FieldName="Title" __designer:bind="{ddwrt:DataBind('u',concat('ff1',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Title')}"/>

<SharePoint:FieldDescription runat="server" id="ff1description{$Pos}" FieldName="Title" ControlMode="Display"/>
0

Using ControlMode="Display" does not work when the ControlMode for this form is "new"; if that is the case then using jquery in this manner will do the same:

$('selector').attr('disabled','disabled')

0

Lost in Alabama's solution works in SP2010 for new forms as well as edit forms; you shouldn't need jQuery for this.

You will, however, need to create a new New Item form and then edit in code view, replacing ControlMode="New" with ControlMode="Display". And of course these shouldn't be required fields.

Here is a New Item form example for an entire row:

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

Result: enter image description here

If you want to hide the field you can simply change the class to "ms-hidden" for both class fields, example:

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

Result: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.