Sometimes we want to create a new template off an existing schema. Microsoft has a great article here (EDIT: that link seems dead, but currently a copy is available here), but for those of you who have already created a form off an existing schema, and just want to know how to unlock it, it can be a bit much to dredge through (also, they don't even mention the little .xsf hack I'm going to show you....). Fortunately, you have me, and I feel your pain.
You saved a beloved form as source files, because its schema was perfect, and you want to base another form off of it. You create a new form template, chosing XML or Schema for the source:
and you happily design away... until you want to add a field. Or change the name of an existing field. That's when you realize.... you're stuck:
See those little locks on the data fields? And at the bottom of the Data Source Task Pane, Add a Field or Group is grayed out....
If you read the article I've linked in the first paragraph, it says:
When you design a form that is based on an external schema, Microsoft Office InfoPath 2007, or Microsoft Office InfoPath 2003 assumes that the schema is finalized and therefore prevents any modification of the schema in the Data Source task pane.
So there you have it. InfoPath figured you were perfectly happy with the schema when you built the form off it.
You can manually add elements to your schema. Save your form as source files and open myschema.xsd in a text editor. Here is my original schema:
And now I've added another string field named String2:
When I save my change and open manifest.xsf in design mode, I can see my newly added field:
But what if you just want it unlocked, so you can add fields like a normal old data source? For that, again, we need to save as source files. Open manifest.xsf with a text editor. Look for your schema file in the files element. You'll see a property named editability which has helpfully been set to 'none':
Set this property to 'full':
Save your changes, and open your template in design mode again:
All your fields will be fully editable.
The Usual Warnings Apply
Save a copy of your form someplace safe before manipulating form files. This is by no means a full discussion of potential pitfalls that can be encountered -- more information on xsf structure is available here. Happy unlocking!