A Cure for the Blues - Hilary Stoupa
in

InfoPath Dev

Hilary Stoupa

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!

Comments

 

Ted Fitch said:

Your blog posts are GREAT Hilary!

January 14, 2009 3:41 PM
 

Graeme said:

I have the blues too big time: I have repeating section inside an optional section inside the main section.

Does this mean I need to add another section to enclose the optional section?

In your cure, all the fields show blue icon and the message about storing duplicate data - is that not a problem?

Thanks for any help

June 1, 2010 1:18 AM
 

Graeme said:

OK, I see the duplicate data thing is not a problem as you simply have 2 different sections to demo the solutions.  And I've used your demo to test my situation which does work if I add my optional section into another section and bind that section to some random field.

My question is now - why should I need to bind the main section to some random field (you bound yours to field2)?  Also, when I change the binding of the main section, all the contained controls lose their bindings which will take me forever to fix up - it there a way round this?

June 1, 2010 2:05 AM
 

Hilary Stoupa said:

I know that the binding to a random field is ... bothersome. However, it does prevent the event bubbling that turns things blue. Generally, I grab everything inside my offending section, move it to a different area of the form, rebind the section, then copy the controls back in -- usually that prevents the unbinding issue....

June 3, 2010 11:47 AM

About Hilary Stoupa

I wandered into development after working as a business process analyst for a global manufacturing company. I create InfoPath solutions for our clients as well as work as a developer on company tools that extend InfoPath. I've also been instrumental in creating the InfoPath Master Class training provided by Qdabra.

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