Thursday, January 5, 2012

Hide 'Submitted By' in InfoPath Browser Form

If you have had to deal with browser forms a lot, you may have run across the ability to send an email with the active view (aka page you are last looking at) as the body of an email to someone. The annoying thing is: it always adds 'Submitted by: BLAH' at the top of the email. I found a way to hide it IF you are sending the email to a recipient that processes <style> elements located in the <head> of the html in an email like Microsoft Exchange aka Outlook or Hotmail (GMail is one of the few that do not). DISCLAIMER: this just hides it and it only hides it ON THE FIRST EMAIL, it doesn't actually remove it from the email so someone *could* go find whoever submitted it if they wanted or see it if their computer is set to NOT process html emails. This also means that when they hit 'reply' or 'forward' it will appear (at least I haven't figured out a workaround for that yet). I have not tested it in a 2007 browser form or using InfoPath 2007 but the theory should work the same.

Steps for InfoPath 2010:
  1. Publish like normal and run your form to send you an email
  2. Open the email and view its source (in Outlook, you have to double-click and open the actual email and THEN you can right-click and then click 'View Source')
  3. Scroll to the bottom and you will see something like this:

    <div style="word-wrap:break-word;color:windowtext;background:window;font-size:10.0pt;font-family:Tahoma" class="GOBBLEDEEGOOK">[Submitted by USERNAME@DOMAIN.COM] <br><hr></div>

  4. Note the 'class=' there...grab your GOBBLEDEEGOOK and copy it (without the quotations)
  5. Go back to your infopath form and publish as source files into a folder on your desktop
  6. Close InfoPath
  7. Open up the folder on your desktop and right-click on the InfoPath view that you are emailing (it will be the name of your view.xsl) in notepad or, preferably, in notepad++
  8. Add the following directly before the "</head>":

    <style>.GOBBLEDEEGOOK{DISPLAY:none !important;VISIBILITY:hidden !important}</style>

    (Just be sure you replace GOBBLEDEEGOOK with whatever your GOBBLEDEEGOOK was). Mine looked like this:
    <style>.D38B7128-85A9-4481-A264-D05E46BC1B50{ DISPLAY:none !important; VISIBILITY:hidden !important;}</style>

  9. Close notepad/notepad++
  10. Go back into the folder on your desktop and right-click on manifest.xsf and click 'Design'
  11. Publish your form like normal
  12. Run a test to see if it hides that dumb 'submitted by' on that particular view/email.