Dynamically change form control types - InfoPath Dev
in

InfoPath Dev

Dynamically change form control types

Last post 08-07-2006 10:09 AM by Greg Collins. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 07-26-2006 12:57 AM

    • henk
    • Not Ranked
    • Joined on 07-26-2006
    • South Africa
    • Posts 4

    Dynamically change form control types

    Hi,
    I am busy with a questionnare type form where the questions, along with an "AnswerControlType" field are read from a database, and the form has to be built based on the values in those fields.
    The answers will be saved to a different table.

    The control type field has to determine the control (radiobutton, checkbox, textbox etc) that should be put next to the question on the form. For example, for a multi-choice question, the control type will be checkbox, and a checkbox from which the user's answer will be read on submit should be put next to the question on the form.

    Could someone please point me to some examples or explain how to accomplish this?
    Thanks!
    Henk
  • 07-26-2006 08:58 AM In reply to

    Re: Dynamically change form control types

    Hi Henk,

    Welcome to our forum! To do this you have to create multiple sections that bind to the same question tree. Each of those sections corresponds to a different question type display. Then based on a node in that tree which specifies the question type, you show/hide the appropriate section. Let us know if that isn't clear.

    Shiraz
    Shiraz Cupala / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 07-26-2006 12:52 PM In reply to

    Re: Dynamically change form control types

    Shiraz is correct--there is no way to dynamically change a control type at runtime... it must be done by binding multiple controls to the same node with conditional visibility deciding which shows.
  • 08-07-2006 06:04 AM In reply to

    • henk
    • Not Ranked
    • Joined on 07-26-2006
    • South Africa
    • Posts 4

    Re: Dynamically change form control types

    Thanks a lot everyone for your input.
    I managed to achieve some sort of success using conditional formatting, but it's not flexible enough and won't solve our problem.
    I downloaded the Visual Studio 2003 toolkit for InfoPath, and I was wondering if it is possible to achieve this using managed code in combination with InfoPath.
    The resources on this toolkit appears to be very limited, so if anyone played around with it, I would really appreciate if you can help me.
    Thanks again.
  • 08-07-2006 10:09 AM In reply to

    Re: Dynamically change form control types

    Sorry--this has nothing to do with Visual Studio or managed code. InfoPath simply won't allow you to dynamically insert controls into the view. If your data source is setup properly you should be able to create quite an elegant solution using conditional formatting on various control types in a repeating section.
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.