Set the default values for a form InfoPath 2007
Author: mety Labels:: Set the default values for a form InfoPath 2007When designing a Microsoft Office InfoPath 2007 form template, you can assign default values to controls that are bound (bind: To connect a control to a field or group in the data source so that data entered into the control is saved. When a control is unbound, it is not connected to a field or group, and so data entered into the control will not be saved.) to fields (field: An element or attribute in the data source that can contain data. If the field is an element, it can contain attribute fields. Fields store the data that is entered into controls.) in the form template. A default value is the value that appears automatically in a control when the user opens a form to fill it out. When you design a form template, you can assign default values to controls in order to help users fill out your form faster. For example, if you create an employee expense report form template, you can assign today's date as the default value for a date picker control. As a result, the current date is automatically populated in the date picker control when the user opens the form, and they do not have to manually enter the date. You can set default values in your form template by:
Set the default value for a controlWhen you set a default value for a field in your form template, you are specifying the value that should appear automatically in the control when a user fills out a form based on that form template.
When you set the default value for a control, you are also setting the default value for the field to which that control is bound. Any control that is bound to that field will be assigned the same default value. If the default value is a specified value, that value is stored in the template.xml file associated with the form template. To programmatically change the default value, change the value of the appropriate field in the template.xml file. If the default value is the result of an XPath expression, the expression is stored in the manifest.xsf file, in the xsf:calculatedField element for the field. Set the default value using a ruleYou can use a rule to set the default value of a control based on the value of another control. A rule is an action that occurs when a condition in the form is met. For example, you might design a form template with a control for the state and another control for the ZIP Code. When a user enters a ZIP Code in the ZIP Code control, the State control is automatically populated with the correct state.In order to complete this procedure, you must have two controls in your form template — one that the user will enter data into, and one that will be populated with a default value, based on the data entered into the first control.
Set all of the default values for a formIf you know all of the controls in your form template that will have a default value, and that the default values are not based on rules, you can set all of the default values at once.
|