Is it possible to hide fields in an InfoPath 2013 field based on the value of another field? Possibly through JavaScript?

I have an InfoPath 2013 form that is linked to a SharePoint 2013 List, and the user wants certain fields to be hidden if the value of another field (a yes/no field) is a certain value. Is this possible? I thought perhaps JavaScript could be used, but I have seen in a couple of places that InfoPath does not have any way of adding JavaScript.

  • You can add a Javascript file to your page using the CEWP and codes to hide the fields
    – Keerthi
    Jun 8, 2015 at 14:45
  • I do not have a lot of experience with InfoPath 2013, could you elaborate a little bit on how to do this? Or do you know of a good resource for me too look into? Thank you!
    – Colin
    Jun 8, 2015 at 14:52

1 Answer 1


This can be done using Rules in Infopath.

There is 3 different types of rule that you can use, Validation, Formatting and Action. They are accessible from the top ribbon tab "Home" and are found almost in the right corner.

enter image description here

Add a formatting rule on the field you wanna hide and set the condition to be something like Yes/No Field is equal to True / False ( or 1 for True, and 0 for false ) and then set the box "hide this control".

The rules will apply as soon the condition is true. Use the preview to make sure that the rule works as expected.

I've answered a similar question before and added some pictures there. Not pretty but it works.

How to hide a label in InfoPath when selecting an option on a combo box?


To apply rules to multiple fields you can put those in a section. Select a session from the control tab and put your text/controls/buttons/images in there and apply a rule to the whole section.

enter image description here

  • Thank you! Worked great. Can rules only be applied to fields? Or is there a way to apply a rule to a table row or text?
    – Colin
    Jun 8, 2015 at 15:07
  • Glad you asked! I'm gonna update my answer Jun 8, 2015 at 15:11
  • That worked really well. Thanks for all of your help!
    – Colin
    Jun 8, 2015 at 15:37

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.