Infopath “Delete Row” button

Here’s a quick bit of code I found on Uday’s mstechblogs site that makes it a bit easier for your users to remove a row in a repeating table. 

 To use this in your form:

  • Add a button
  • Access the button properties
  • Fill out the Label and ID fields, then select “Edit Form Code…”
  • Find the code for your button’s clicked event
  • Add this short line of code after the comment line:
    • // Write your code here.
      e.Source.DeleteSelf();

And that’s it. Preview your form and add a series of extra rows in the table. A click of your new button and the line will be gone. Makes things easier for end users; they just click a shiny button instead of using the table menu to remove each repeating row.

One thought on “Infopath “Delete Row” button

  1. Hi,great post! I have learned a lot from it. However (and isn’t there nlarey always one..) I have a customised SP2010 List form with Add and Edit views which allow user to update info as well as two read-only views which are used to produce a printout in association with some CSS to hide other web page elements when printing (one is a certificate for local court to show a participant has attended/completed a court mandated traffic offender program and the other is a certificate for folks who attended just because they wanted to be better drivers).I have placed buttons on the Edit view to the two read only views and set rules to 1) submit data then 2) switch view. My problem is that after updating some info on the Edit view and clicking either of these buttons, the updates aren’t showing (i.e. the data is as it was when the form was initially loaded). How can I force the view to reflect all the current information so that I don’t have to have the user save/close the form and then re open it just to get up to date information on the read only print views?Any tips would be greatly appreciated, this has been driving me nuts for days and all my Googling and delving in to my InfoPath books has come to nought

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>