Need help with Template Parts based on schemas

J

Jose

I have trouble using InfoPath template parts that are based on schemas to
build Infopath forms.

I have created three schema-generated parts, and have installed them in the
custom controls section. When I try to create a template form by dragging one
of the template parts onto the design surface, instead of the form template
displaying I get a screen labelled TextXMLBinding. In the screen, the Data
Source field is grayed out but displays Main. A truly cryptic message appears
on the screen: "To set the binding, select a field or group in which to store
the control's data". In the screen there is a group called MyFields, with no
fields. None of the content of the template part appears. And the screen
focus is captured by the screen, so I cannot access any part of the UI.

If I create another template part from scratch, that is, based it on
InfoPath UI, install it in the Custom Control area, the resulting form
displays correctly and operates normally.

I have tried to build a template part based on XML and, again, it fails in
the same fashion to build a template form correctly.

The problem seems to be with both xml and schema-based template parts. Any
help will be greatly appreciated. Any help will be greatly appreciated.
 
G

Gavin McKay

Hello,

This is what I *think* is happening - if anyone disagrees please post, not
100% sure on this theory...

Are you creating your template parts based on existing schema? In that
case, I think InfoPath would have trouble including the template parts in
another form template. The reason for this is that you have one schema in
your template part, and another schema in your form, then the two won't be
able to coexist happily. Let me try and explain with an example:

1. Template web part based on schema requires the element "myElement" to be
the first node
2. Form template has schema and requires the element "yourElement" to be the
first node

when you add your template part to your form template, the schemas will
clash - both expect different elements as the first node. Hence InfoPath
assumes you are going to attach it to something else (like a secondary data
connection) and gets upset.

IMHO template parts are really for creating some standard InfoPath-friendly
UI components and not for schema-based enforcement. You could possibly
create a template part from scratch so that it matches your schema - then
InfoPath should be able to add it to the existing template schema OK.

HTH

Gavin.
 
J

Jose

Thank you, Gavin. Your analysis was correct. I have created the part template
from scratch and made it to match my schema. Now I can reproduce the part's
form when i drag the groups and fields onto the design surface and select the
custom part containing the template part.
 
T

Tebe

Why then do we even have the option of creating the part based on the schema?

If it can never be imported to a form properly? As I understand it, both
methods of part creation include a schema, just one you specify and the other
is generated for you. When you specify your own, the structure can be much
Richer - using custom types, type extension, reg expression validation etc...
but it's all for nothing because you can't import it easily. Not to mention
the pain in the *ss rebuild you have to undertake when you have made a
mistake in the XSD!

I say 'not easily' because you can add a "full schema" element to the form
at the time you are prompted to "Set the binding", then InfoPath will let you
add the template part, with another warning "This action can cause behavior
changes in existing forms that include this template part"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top