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

On This Page

Expand all | Collapse all

SYMPTOMS

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.

CAUSE

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.

WORKAROUND

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:
  1. Start InfoPath 2007, click Design a Form Template, select Blank, and then click OK.
  2. Click Controls, and then add a Text Box control to the left pane. The default name of this field is field1.
  3. Double-click the text box, select Date (date) in the Date type drop-down list, and then click OK.
  4. Click the Format button.
  5. Select the format, for example 3/14/2001, and then click OK.
  6. Click OK one more time.
  7. Add a Button control to the left pane. The default name of this control is Button.
  8. Double-click Button, click Rules, and then click Add.
  9. Click Add Action, select Set a field's value in the drop-down list.
  10. Click the icon that is next to the Field text box, and then select field1.
  11. Type a validate format date, for example 2006-09-30, and then click OK.
  12. Click OK three times.
  13. Click Preview on the toolbar, and then click Button. You will see 9/30/2006 shown in the date field.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to reproduce the behavior

  1. Start InfoPath 2007.
  2. Click Design a Form Template, click Blank, and then click OK.
  3. Click Controls, and then add a Text Box control to the left pane.

    By default, the name of this control is field1.
  4. Double-click field1, click Date (date) in the Date type list, and then click OK.
  5. Add a Button control to the left pane.

    By default, the name of this control is Button.
  6. Double-click Button, click Rules, and then click Add.
  7. Click Add Action, and then click Set a field's value.
  8. Click the icon that is next to the Field box, and then click field1.
  9. Type a date in a format that is not valid, and then click OK.

    For example, type 9/30/06, and then click OK.
  10. Click OK three times.
  11. On the toolbar, click Preview, and then click Button.

APPLIES TO
  • Microsoft Office InfoPath 2007
  • Microsoft Office Forms Server 2007
Keywords: 
kbexpertiseinter kbtshoot kbprb KB924727
 

Article Translations

 

Related Support Centers