InfoPath: Hide Command Text for Conditionally Inserting Row in Repeating Table

Category: Infopath

Problem 1

Allow the users to insert a row in repeating table based on condition evaluation.


Select the repeating table, right click on it to open up context menu.

Click on “Repeating Table Properties…” > “Display Tab” > “Conditional Formatting…” button. It will open up “Conditional Formatting” dialog.

Click on “Add…” to open up “Conditional Format” dialog.

Select the condition and check “Don’t allow user to insert or delete this control” as shown in the image below.

InfoPath conditional format dialog

Click OK button on every open dialog.

Now preview the form. Based on evaluated condition, clicking on “Add Employee” will either allow or don’t allow you to insert a new row.

Problem 2

Above mentioned solution does not hide the command text “Add Employee” so user may try to click on it but nothing happens. The problem is to hide a command text.


Solution requires manual xsl file editing. Follow the steps to manually change xsl to show/hide command text based on the condition.

Open the form into design mode. Click on File > “Save As Source Files…” (InfoPath 2007) which will save individual source files.

Open the appropriate view file in text editor. The file extension will be “.xsl”.

Locate the code which shows command text. For me, it is

<div xd:xmlToEdit="group2_1" xd:action="xCollection::insert">Add Employee</div>

Now add a conditional “style” attribute to it. so the resultant code will look like

<div xd:xmlToEdit="group2_1" tabIndex="0" xd:action="xCollection::insert">
 <xsl:attribute name="style">
 <xsl:if test="my:AllowInsertion = string(false())">DISPLAY:None;</xsl:if>
Add Employee</div>

In the above code you have to change the <xsl:if> test attribute to your condition

Save the file, open the form in design mode by right clicking on “manifest.xsf” file and click on “Design”.

Now when you preview the form, it will look like this

InfoPath condition false
InfoPath condition true

Download the example InfoPath form to hide command text for conditionally inserting row in repeating table.



Your email address will not be published. Required fields are marked *

  1. joao says:

    very helpful!

  2. alice says:

    Cool!!! very simple solution. Almost i spent 6 hours for this.
    Thanks dude!!!

  3. vijay bhaskar says:

    Its not working in Browser enabled Infopath forms 🙁

  4. vijay bhaskar says:

    Cool!!! very simple solution. Almost i spent 6 hours for this.
    Thanks dude!!!