Article ID: 924727 - Last Review: November 3, 2006 - Revision: 1.3
The date is not parsed correctly when you set the date by using a rule in InfoPath 2007
When you set a date by using a rule in Microsoft Office InfoPath 2007, the date is not parsed correctly. Additionally, the date field displays a red, dashed border that indicates that the value is not valid.
This behavior occurs because the date must be in the
YYYY-MM-DD format when you set the date by using a rule or by using code. If the date is not in this format, the date is not parsed correctly, and the date is displayed as a value that is not valid.
To work around this behavior, use a date that is in the
YYYY-MM-DD format when you set the rule. To do this, follow these steps:
Start InfoPath 2007, click Design a Form Template , select Blank , and then click OK .
Click Controls , and then add a Text Box control to the left pane. The default name of this field is field1.
Double-click the text box, select Date (date) in the Date type drop-down list, and then click OK .
Click the Format button.
Select the format, for example 3/14/2001, and then click OK . Click OK one more time.
Add a Button control to the left pane. The default name of this control is Button.
Double-click Button , click Rules , and then click Add .
Click Add Action , select Set a field's value in the drop-down list.
Click the icon that is next to the Field text box, and then select field1 .
Type a validate format date, for example 2006-09-30, and then click OK .
Click OK three times.
Click Preview on the toolbar, and then click Button .
You will see 9/30/2006 shown in the date field.
This behavior is by design.
Steps to reproduce the behavior Start InfoPath 2007. Click Design a Form Template , click Blank , and then click OK .
Click Controls , and then add a Text Box control to the left pane. By default, the name of this control is field1. Double-click field1 , click Date (date) in the Date type list, and then click OK . Add a Button control to the left pane. By default, the name of this control is Button.
Double-click Button , click Rules , and then click Add .
Click Add Action , and then click Set a field's value .
Click the icon that is next to the Field box, and then click field1 .
Type a date in a format that is not valid, and then click OK . For example, type 9/30/06 , and then click OK .
Click OK three times. On the toolbar, click Preview , and then click Button . APPLIES TO Microsoft Office InfoPath 2007 Microsoft Office Forms Server 2007 kbexpertiseinter kbtshoot kbprb KB924727