0

This question already has an answer here:

I'm trying to create a form in SharePoint Designer 2013, I want to be able to hide a specific field in the form unless the answer to another field has been changed to a specific option. Here is my code:

<tr>
    <td width="25%" class="ms-vb">
        <b>External Sales?:</b>
    </td>
    <td width="75%" class="ms-vb">
        <SharePoint:FormField runat="server" id="ff438747{$Pos}" ControlMode="New" FieldName="External_x0020_Sales_x003f_" __designer:bind="{ddwrt:DataBind('i',concat('ff438747',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@External_x0020_Sales_x003f_')}" />
        <SharePoint:FieldDescription runat="server" id="ff219374description219373{$Pos}" FieldName="External_x0020_Sales_x003f_" ControlMode="Edit" />
    </td>
</tr>
<xsl:if test="@External_x0020_Sales_x003f_ = 'Yes'">
<tr>
    <td width="25%" class="ms-vb">
        <b>PPE:</b>
    </td>
    <td width="75%" class="ms-vb">
        <SharePoint:FormField runat="server" id="ff438748{$Pos}" ControlMode="New" FieldName="PPE" __designer:bind="{ddwrt:DataBind('i',concat('ff438748',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@PPE')}" />
        <SharePoint:FieldDescription runat="server" id="ff219375description219373{$Pos}" FieldName="PPE" ControlMode="Edit" />
    </td>
</tr>
</xsl:if>

As you can see, I want to be able to make it so when "External Sales?" = Yes, then it shows the field "PPE".

Any help on this matter would be greatly appreciated.

marked as duplicate by Asad Refai, Paul Strupeikis, Waqas Sarwar MVP, Robert Lindgren Nov 8 '16 at 18:51

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

Open form in the browser and inspect the column. Each column has unique Guid and hide that column using Jquery.

for example if the column has this id then

("#ctl00_ctl46_g_6e00098d_430d_4915_b0ae_32d447cebddf_ff11_ctl00_ctl00_TextField").css("visibility", "hidden");

Later use this condition to show the hidden column like this

if ($('#ExternalSalesColumnGuid').text() == "yes")
{
$("#ctl00_ctl46_g_6e00098d_430d_4915_b0ae_32d447cebddf_ff11_ctl00_ctl00_TextField").css("visibility", "visible");
}
  • Dont forget to make the else to show again if the value of the field is different of Yes. – Thales Chemenian Nov 8 '16 at 13:58

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