Join Gini von Courter for an in-depth discussion in this video Using text controls , part of InfoPath 2010 Essential Training.
We're back in our Web Post Request InfoPath template that we're designing. While you were gone, I added more sections to this template. I assume you did to yours as well. So here's a section for department info, a section for news, and so on, and all of these are inside of a large section called posts. It really works if you click each section, and notice in the data source what's highlighted. It should work its way up the form in a way that makes perfect sense to you. So we have a section that we inserted earlier.
It's for requestor section down below for posts that encompasses all of the rest of the form all the way up to here. Now we're going to add our text box controls and our date pickers. So the first thing that we're going to enter is we're going to enter the email, name, department information, so on for the requestor. So first, we'll let the person type their First Name and click where it says Add control.
Now, again our choices are to drag a control over here, and if we do, then we'll just have some extra space. I'll show you later in the course how to have InfoPath not do that if you don't want it to, and we're going to click and do a Last Name and add the Last Name control. If you don't want to add all of the labels at this time, you don't have to, because the fact that the field name comes over is very helpful.
So you could just choose now to add, for example, the email and just drag it in here and wait to enter the label later, because we have that information. All of these are text box fields. So if I double-click and choose Control Properties or click the control, right-click, and choose Text Box Properties because it's a text box, I will get to see all of the properties that I can set for this control. Now the fact that this control holds text was actually set over here by the fact that this field is a text field, or as it's called, a string.
But the text box has properties of its own. For example, I can put in a default value. Now, that doesn't make a lot of sense if you put in a first name. What would be the normal first name, Betty, or Joe, or...hard to know. But the other choice that we'll make here is we can say I don't want to get one of these forms where someone hasn't filled in their name. So we're going to say this cannot be blank. I'll then move to the Display tab and say I could put click here and type, but in this form I have light areas where people enter text, and I'm going to have areas with a shaded background where they can't.
That's actually how Windows works. People are very used to typing in this box. For example, you don't need a lot of anything typed in this placeholder to know that you could type a placeholder here. So we're going to leave this. We can enable the spelling checker, but this is a first name. We might not want to do that. We also can choose to make this multi- line to limit the number of characters. Neither of those are appropriate in the case of a first name. And we can set its alignment. The next tab is Size and this is specifying how this text box control operates, how large it is, how much space is left around the text--that's what padding is--what the margins are within it, and then you can align the control and the label very easily by simply clicking and clicking Align, so that you'll have these in the same place.
Our table does that for us, and we don't need to do it because we are using the table. I can finally click on Advanced. I could offer a screentip here so that when someone points to the control, they see information about it. You will only want to do that in one of two ways. There are people who put a screentip in for every single control in a form. It's a little bit annoying each time you point to a control to have it pop up, if it's a form that you use regularly or is very easy to use. For example, I don't know how much information we would have to give someone for them to figure out that they type their own first name here.
So I think we'll probably leave that. But you could put a screentip in every control. What some form developers choose to do is to save screentips for fields where users would commonly have a question about how to complete it, and only to use them in a few areas. We can now go to Browser forms, and we'll be looking at this property later when we see how to create thin client forms in Microsoft InfoPath. So between these five tabs, you have really everything you can easily do to a control, other than formatting it using the traditional font tools and other formatting tools. Let's click OK.
We're going to require a last name, too. So I am going to go to the Text Box Properties and say it cannot be blank. This is an email address. Likewise, we can look at its Text Box Properties. I need to be able to get a hold of this person, so I'm going to say Cannot be blank and choose OK. That's how you set the properties for text boxes. Now we also have a couple of other controls that are here in our post section, the title of the post and the description of the post, and that's what this part of the form is for.
Let me just do a little bit of cleanup here before I leave. Let me go ahead and first make sure that I've done my spellcheck on First Name. Let me add the label Email Address. Those three controls are fine. Now, title of a post, description of a post. So we'll put in an appropriate label, like Post Title, and we're going to use this later on in our form when we publish it as part of the file name, so we'll want to provide some additional help with this field.
Let's go ahead and drag Post Title over here, and it will place the default check box. Delete the extra text that it gives us. Now let's set some of the properties of this control. Specifically, it can't be blank because we need to use it for part of the file's name, but we are also going to actually provide a placeholder here that says, "This will be used as a file name, so no punctuation, please." We'll enable the spelling checker. That works fine.
Notice that we see this. However, notice also that if we publish this as a web form, we will not see any placeholder text that we enter. So this means that this text will only be shown if someone uses the InfoPath Filler application to fill this form. Now we're going to add a description, and we can drag the Post Description field here, and we have a couple of choices. We could choose to make this a rich text control, and if we wish to do that, then the data type over here should be different, because it's only a string.
So we could allow the user to provide formatting, to bold, to underline, and so on. But when they save it, it's going back to a string control, and that won't work. So, given that this is a string and we like it the way it is, we really want somebody just to provide a text description that's relatively brief. What we'll do is we'll set the properties of this control to allow a couple of other options. First, we'll say it can't be blank. But then we'll say that actually the user can enter paragraphs of data.
They could type a paragraph, press Enter, type another paragraph, press Enter, and so on. And again if this is going to be filled out in the InfoPath Form Filler, I'll say, "Provide a brief description of your post's content." So we've now used a text control, a text box control, and we've also used a multi-line text box control. What would it be like if we were to use a rich text box control? Well, if we choose to use a rich text box control, it has slightly different properties.
In a rich text box control, we have the ability to actually put a scrollbar in, and so if someone is entering data and they fill up the box we gave them, we can tell the box to expand to show all text. That's not going to work over here with our plain text control, our text box. If we want to provide more space in our text box, we actually have to make the text box bigger, but with the rich text box, I can say Expand or Show a Scrollbar.
So I could expand it so it will show three or four lines. I could say scroll automatically, or I could allow it to scroll in both directions, which users don't typically like very much. The best choice, if you have the space, is to say Expand to show all text. One of the biggest distinctions between your plain text box then and your rich text box is that if you believe your users may type a widely variable amount of information here-- for example, some might type one paragraph and some might type six-- if you want to easily see it all, you'll want to move to a rich text box control and allow the control itself to expand to show all of the text that the user entered.
Those are our text box controls. Easy to place in your document. Easy to set the properties of. Feel free to use them as you will, very broadly, in all of your InfoPath forms.
- Creating a template from scratch
- Understanding and modifying data sources
- Formatting a template
- Inserting text controls, data pickers, and check boxes
- Catching incorrect or missing data
- Using tables and sections for repeating data
- Calculating a value with form data
- Checking spelling and testing a template
- Creating views
- Developing data connections to SharePoint lists and XML files
- Understanding publishing options for InfoPath templates
- Importing Excel and Word forms