January 2009 - Posts - Hilary Stoupa

InfoPath Dev

Hilary Stoupa

January 2009 - Posts

  • A Cure for the Blues

    Ever design a form with 'The Blues'? You preview the form (or publish it out for your users) and it seems like no matter where you click on the form the whole form is selected, highlighted blue?

    Form with blue highlight
    This is, after all, pretty much an aesthetic issue. It doesn't really hurt anyone. But frankly, I find it annoying, and I bet you do too. And your users will very likely be at least perplexed. Fortunately, the fix is pretty straightforward. Here is a link to the simple sample form I'll be using for this post, in case you'd like to follow along at home.

    First off, you will find that it is a repeating group or field causing your problem. You can find out which one by right-clicking on your blue highlighted section:
    Repeating "insert" right click
    Notice the "Insert group2" menu item? Taking a look at the data source for this form, we can see:
    Data Source

    And, if we look at our troublesome view in design mode:
    View in design mode

    This form has a main section bound to the root of the data source, and then has a repeating group bound to a control that has been placed into that section. The 'insert' action for our repeating table is causing the problem in this sample -- repeating sections or repeating fields can also cause this problem. We have some choices: 1) place the repeating table inside another section to 'contain' the insert action or 2) take everything out of the section bound to the root node. Since I really like putting stuff in sections (if I don't I always regret it later -- I can almost bet there will be some reason I'll want to conditionally show / hide the section), I tend to take the first route:
    The Cure -- put the repeating section in another section

    In this view, I've put the repeating section (bound to group2) into a new section that is bound to group1. I removed the borders from the section and set the margins and the padding to zero. When I preview this view, the table's insert event will highlight the section bound to group1:
    The cure -- preview

    Unfortunately, this alone will not solve our problem. The section bound to the root node will still highlight. If you modify the binding of the main section, however, so it is connected to a field or group that does not contain a repeating group, your blues will be resolved:
    Main section bound to field

    Another method is to take the repeating table out of sections entirely in the form:
    The Cure -- no sections

    Make it a habit to tuck those repeating sections, tables and fields into non-repeating sections all by themselves, and you can lose the blues!

Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.