Min/Max Error Message Limitation - Greg Collins

InfoPath Dev

This Blog


Greg Collins

Min/Max Error Message Limitation

I wrote to my Microsoft contact a while back to request that a future version of InfoPath make the repeating sections smart enough to realize that they have hit the specified min or max limit and then hide the appropriate widget for insert or remove.

But while trying to discover a way to work around that, I noticed that the error message that pops up when a min or max condition is hit happens before, and instead of, the OnBeforeChange() event handler. This is bad because there is no way for the form developer to show their own error message. Instead you are stuck with the default cryptic error message that InfoPath supplies, namely:

On insert:

InfoPath cannot insert the section or row because of an error.

The attempted fragment operation cannot be completed because there is no valid insertion point for the fragment.

On remove:

The item cannot be removed.

Content for element '{http://schemas.microsoft.com/office/infopath/2003/myXSD/2004-07-01T23:47:14}group1' is incomplete according to the DTD/Schema.

Another idea I had while playing with this, and recommended Microsoft implement in conjunction with the aforementioned idea is: Allow rules to separately control the insert and delete widgets and the menu items that appear.

So for example, if you have a limit of 10 rows, but you only want the user to insert 3 a maimum of 3 rows under a certain condition, then you could set a rule that would disable the "Insert" feature until the condition was no longer valid. The same thing would work for removing rows.

These would be very powerful and very useful.

©2004 Greg Collins. All rights reserved. Licensed to Autonomy Systems, LLC for display on InfoPathDev.com.



dashughe said:

I believe I have a similar issue - I am an InfoPath newbie so I'm not 100% sure - I have a repeating table based on an XSD that defines min & max to be 1 and 12 respectively, and when I click "Insert Item" I get the aforementioned error on insert.

What is the solution to this problem?  Is it a rule?  or C# code?

August 19, 2008 5:39 AM
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.