Optional Choice - InfoPath Dev
in

InfoPath Dev

Having trouble finding a blog or post that answers your question? Check out our Custom Search Page

Optional Choice

Last post 06-20-2008 02:39 AM by Gabriele.Giuseppini. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 06-16-2008 06:49 AM

    Optional Choice

    Hello all,

    I need to have a form section representing an "optional choice", for lack of a better term :-) Basically, my schema looks like this:

    <xsd:element name="elements" minOccurs="1" maxOccurs="1">
        <
    xsd:complexType>
            <
    xsd:sequence>
                <
    xsd:element ref="textElement" minOccurs="0" maxOccurs="1"/>
                <
    xsd:choice minOccurs ="0" maxOccurs="1">
                    <
    xsd:element ref="imageElement" minOccurs="0"/>
                    <
    xsd:element ref="animationElement" minOccurs="0"/>
                    <xsd:element ref="videoElement" minOccurs="0"/>
                </
    xsd:choice>
                <xsd:element ref="audioElement" minOccurs="0" maxOccurs="1"/>
            </
    xsd:sequence>
         </xsd:complexType>
    </
    xsd:element>

    As you can tell from the schema, the user can add one image, or add one animation, or add one video, or add none of these three. What section / construct is best suited for these? Note that I'd like the form to have an "insert button/hint text" kind of like "Click here to add an image, animation, or video", exactly like with an optional section....I wish I could have an "optional choice" :-)

    Thanks so much in advance!!!!

  • 06-17-2008 04:21 PM In reply to

    InfoPath includes a "Choice Group" control. That is what you need here.

  • 06-18-2008 01:28 AM In reply to

    Yep, thanks, I looked at that - the problem is that the Choice Group does not allow me to choose whether or not I _want_ the choice. In other words, I need to have a choice that is _optional_ in itself, with a button saying "Click here to add an A or a B". 

     

  • 06-19-2008 10:09 AM In reply to

    Seems like there was a way to default it to a certain choice and not offer the user a chance to change it. I don't have time to look into it right now... but I'm sure you could do this.

  • 06-20-2008 02:39 AM In reply to

    Great, thanks! I'll look into it. For the moment I've changed the schema to "encapsulate" the three choices within an optional element, so that the user has the option first on whether or not inserting any of the three items, and then she can decide which of the possible choices to pick.

     

Page 1 of 1 (5 items)
Copyright © 2003-2017 Qdabra Software. All rights reserved.
View our Terms of Use.