We have a custom list with choice radio button field with values (Yes,No) and a Checkbox field. We want to hide the Checkbox when user click no, how we can achieve this in SPD?

what is the best way to do this?

  <td width="190px" valign="top" class="ms-formlabel">
    <H3 class="ms-standardheader">
       <nobr>Test1  Assigned?<span class="ms-formvalidation"> *</span></nobr>
  <td width="400px" valign="top" class="ms-formbody">
    <SharePoint:FormField  runat="server" id="ff29{$Pos}"
                           ControlMode="Edit" FieldName="Test1_x0020_PM_x0020_Assig"
    <SharePoint:FieldDescription runat="server" id="ff29description{$Pos}"
                                 ControlMode="Edit" />
    <H3 class="ms-standardheader"><nobr>Test2 PM Name</nobr></H3>
    <SharePoint:FormField runat="server" id="ff4{$Pos}" ControlMode="Edit"
    <SharePoint:FieldDescription runat="server" id="ff4description{$Pos}" FieldName="Engineering_x0020_PM_x0020_Name" ControlMode="Edit" /></div></td>

2 Answers 2


i did this recently.the trick here is to attach an onchange event to your yes/no field on page load, use this code :

<script type="text/ecmascript">
   if (window.attachEvent){
       window.attachEvent('onload', OnLoad);
   }else if (window.addEventListner){
       window.addEventListner('load', OnLoad, false);  
       window.onload = OnLoad;

   function OnLoad(){
      //Attach the onchange event to your yes/no field  
          // this code is executed everytime the yes/no value changes
          // do wathever you want here to manage
          var el = document.querySelector("span[title=yesnofieldname]");
          if (el.value == 'No'){
             document.querySelector("span[title=otherfieldname]").style.display = 'none';

i hope this is what your are looking for.


I like to use jQuery for this sort of operation. you can also use XSLT Conditional Formatting in the form, but I feel it is far harder to read and debug than jQuery.

  1. Add jQuery to your page.

  2. View the page's source in IE and get the id of the control you wish to monitor for changes in value..

  3. Add an id='some_text' attribute to the table row you wish to show/hide using SP Designer.

  4. Learn to use jQuery to attach a change event to the control whose value determines what is being shown/hidden.


         //Select the very long GUID of the control and attach the change event handler
               //Run a function to evaluate what to do when the value is changed.
  5. Within the function you are using to do all the work, set the visibility of the table row.


And that should do it. The XSLT written by designer is exceptionally hard to read and, IMO, next to impossible to change after you have it set. So jQuery is really the option to work with for these sorts of tasks.

  • I am new to jquery, can you please provide me the whole code if possible.
    – user9052
    Jun 22, 2012 at 23:50
  • Without access to you environment that will be a little hard. I've provided you with the links required to figure it out. But as I am not on your payroll, you can put some more effort in. Jun 25, 2012 at 12:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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