Free Training: Data-Driven Design - Using Default Data (Lab 1) - Mel Balsamo
in

InfoPath Dev

This Blog

Syndication

Mel Balsamo

Free Training: Data-Driven Design - Using Default Data (Lab 1)

In this lab, you will be provided with a starter form template that has a simple pre-designed layout, the schema, and an email submit data connection so that you won't have to create them from a blank template.

Take time to familiarize yourself with the form schema by looking at the fields in the main data source as well as how the controls are laid out on the design canvas.

Add Default Values to the List of Modules

Notice the Module dropdown - this lists all the modules with default values which we will configure in this lab. If you right-click on the SelectedModule dropdown list box (under the heading Select a Module) and select to show its properties, you will see that it gets choices from the Module repeating group - from within the main data source.

In order to provide options for this dropdown, we need to add default values for the ModuleNo and ModuleName fields.

1.       Go to the Data tab > Default Values.

2.       Expand Modules > Module (first repeating group), select ModuleNo and then enter the default value: 1.

3.       Select ModuleName and then enter the default value: Module 1 - Getting Started.

4.       For the second Module repeating group, add the following default values:

  • ModuleNo: 2
  • ModuleName: Module 2 - Schemas

You may also add default nodes manually. For this lab, we will add a third Module.

5.       Click on the down-arrow key next to the second Module repeating node, and then select Add another Module below.

This will add another set of Module and Questions with the last-entered values copied over by default.

6.       Replace the default values with the following:

  • ModuleNo: 3
  • ModuleName: Module 3 - SharePoint Integration

7.       Click OK when done.

When you preview your form template, you should see the Module dropdown list box populate with the default values you've added:

Add Default Values to the List of Questions

We will also ‘hardcode' values for the QuestionNo and the QuestionText fields, hence giving them their default values.

8.       Close Preview and then go back to the Data tab > Default Values.

9.       Expand Modules > Module > Question.

10.    Each module will have a list of three questions. Add the following default values for the QuestionNo and the QuestionText for each corresponding module (to save time, copy from this document and paste into the Default Value box of the respective field).

ModuleName
QuestionNo
QuestionText
Module 1
1
Guidance text helps users fill out forms. List three ways to add guidance text to your form.

2
InfoPath Designer starts with the main data source. When building a form from the ground up (blank), why is it important to identify your secondary data sources up front?

3
How do you uniquely name an email when you submit the form?
Module 2 1
What are the pros/cons of using an XML resource in the XSN vs. XML from a network share?

2
How do you change the default value for choice group?

3
How do you change default value for choice group?
Module 3 1
What's the difference between Save and Submit?

2
Why does Microsoft promote SharePoint workflows? Why are the benefits?

3
List 3 things that browser-based forms can't do. Why not?

Let's also add two more default Question nodes for Module 3; but this time, there will be no default values for the questions, i.e. blank - we will conditionally hide blank questions later.

11.    Click on the down-arrow key next to the last Question repeating node, and then select Add another Question below twice.

12.    Delete the copied-over values in the QuestionNo and QuestionText fields for both nodes.

13.    Click OK when done.

Conditionally Hide Questions

If you preview your form template at this point, you will see all the default questions you've just added. We don't actually want to show them all. Instead, we'd want to display only those questions corresponding to the selected module.

14.    In the Fields taskpane, select the Module repeating node.

15.    From the Home tab > Rules section, click Manage Rules to display the Rules taskpane.

16.    Add a conditional formatting that hides questions that don't belong to the selected module.

a.   Click New > Formatting.

b.   Name your condition something like "Only show questions for the selected module".

c.   Click ‘None' under Condition to display the dialog where you can add your conditions

d.   In the Condition dialog, leave the first dropdown pointing to the ModuleNo field but change the comparison (second dropdown) to ‘is not equal to'.

e.   On the third dropdown, choose Select a field or group..., choose the SelectedModule field of the Main data source.

f.   Click OK twice and then check the box ‘Hide this control'.

Your conditional formatting should look similar to this:

We also need to conditionally hide questions that have no default values, i.e. those that are blank.

17.       In the Fields taskpane, select the Question repeating node.

18.       Add your conditional formatting:

a.   In the Rules taskpane, click New > Formatting.

b.   Name your condition something like "Hide blank questions".

c.   Click ‘None' under Condition to display the dialog where you can add your conditions

d.   In the Condition dialog, leave the first dropdown pointing to the QuestionNo field but change the second dropdown to ‘is blank'.

e.   Click on the button labeled And and then change the operator to or.

f.   Select QuestionText in the first dropdown and then change the second dropdown to ‘is blank'.

g.   Click OK and then check the box ‘Hide this control'.

Your conditional formatting should look similar to this:

Once again, preview your form template. After you select a module, you should be able to see the default questions for that module. If you select Module 3 - SharePoint Integration, you should still see only 3 sets of questions - others that have blank values are hidden.

Comments

 

Mel Balsamo said:

In this lab, your business process has evolved and you have many more questions and answers. You decide

December 11, 2010 10:12 PM
 

Patrick Halstead said:

I've decided to do it

December 21, 2010 5:55 AM
 

Gennady Vanin (Геннадий Ванин, Новосибирск) said:

I cannot find any 1+ (2nd, 3d) labe by Mel Balsamo.

Can you give me references

Also, it is confiusing that Jennifer Walts' articles also have in title  "Lab 1" and "Free training:"

Wouldn't have it  been better to have such common words somewhere in tags instead?

July 14, 2012 10:54 PM
Copyright © 2003-2012 Qdabra Software. All rights reserved.
View our Terms of Use.