Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / November 2004

Tip: Looking for answers? Try searching our database.

Rules stop working when fields are updated

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
aturner - 03 Nov 2004 22:37 GMT
My form includes fields that are filled in automatically, through rules,
based on selections in other controls.  This works fine, until a selection is
changed -- the other fields should update automatically when a change is
made, but they don't.  In other words, it seems that the rules only run at
initial selection.

The controls are:
Maintenance (checkbox)
Price (read-only text field)
Product (drop-down list)

When Maintenance is selected, the Price is filled in based on the Product
selection.  But when the Product is changed, the Price does not update to
reflect the new Product.

Is the best approach to add an OnAfterChange event that clears the
Maintenance checkbox whenever the Product is changed?  I'm not a programmer,
so I will need a script example.  Or perhaps there's a problem with the rules?

Any help will be appreciated.
Greg Collins [MVP] - 03 Nov 2004 23:05 GMT
Rules are based on the field the control is bound to changing values. If you select or clear the check box, that has no relation to whether you select a product. If you want both updates to change a field, you must have rules on both fields. If the price should only be changed if the check box is selected, you must account for that in your rules on both controls.

I hope this helps.

Signature

Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com

My form includes fields that are filled in automatically, through rules,
based on selections in other controls.  This works fine, until a selection is
changed -- the other fields should update automatically when a change is
made, but they don't.  In other words, it seems that the rules only run at
initial selection.

The controls are:
Maintenance (checkbox)
Price (read-only text field)
Product (drop-down list)

When Maintenance is selected, the Price is filled in based on the Product
selection.  But when the Product is changed, the Price does not update to
reflect the new Product.

Is the best approach to add an OnAfterChange event that clears the
Maintenance checkbox whenever the Product is changed?  I'm not a programmer,
so I will need a script example.  Or perhaps there's a problem with the rules?

Any help will be appreciated.
aturner - 04 Nov 2004 19:40 GMT
Yes, that worked -- thanks!  However, now that I've added more rules, I get
the following error when filling out the form:

An error occurred in the form's code. The number of calls to the
OnAfterChange event for a single update in the data exceeded the maximum
limit.

Recommendations?

> Rules are based on the field the control is bound to changing values. If you select or clear the check box, that has no relation to whether you select a product. If you want both updates to change a field, you must have rules on both fields. If the price should only be changed if the check box is selected, you must account for that in your rules on both controls.
>
[quoted text clipped - 20 lines]
>
> Any help will be appreciated.
Josh Bertsch [MSFT] - 05 Nov 2004 02:04 GMT
InfoPath recognizes loops and stops them after 15 itereations (this, I
believe, is an IE limit).  As such, if you have rule that has a calculation
that has a loop (a rule on a text box that has a rule that sets it value to
1 + itself).  Or if you have > 15 rules that get fired after just 1 action
you will run into this.

--josh bertsch

> Yes, that worked -- thanks!  However, now that I've added more rules, I
> get
[quoted text clipped - 39 lines]
>>
>> Any help will be appreciated.
Greg Collins [MVP] - 05 Nov 2004 19:27 GMT
You likely have a loop -- some value changing, firing a rule which changes another value, which in turn changes another value... and so it goes in an endless loop.

You will need to write code in your OnAfterChange event handler to return if the change was caused by a field you were expecting (i.e. because of your rules).

Signature

Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com

Yes, that worked -- thanks!  However, now that I've added more rules, I get
the following error when filling out the form:

An error occurred in the form's code. The number of calls to the
OnAfterChange event for a single update in the data exceeded the maximum
limit.

Recommendations?

"Greg Collins [MVP]" wrote:

> Rules are based on the field the control is bound to changing values. If you select or clear the check box, that has no relation to whether you select a product. If you want both updates to change a field, you must have rules on both fields. If the price should only be changed if the check box is selected, you must account for that in your rules on both controls.
>
> I hope this helps.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.