Multi selection list in Infopath 2010 - InfoPath Dev
in

InfoPath Dev

Multi selection list in Infopath 2010

Last post 06-18-2011 01:31 PM by Patrick Halstead. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 06-17-2011 10:07 AM

    Multi selection list in Infopath 2010

    In a Infopath 2010 web form, I've a multi selection list bind to a secondary data source. When the list is populated all items are uncheck.

    How can I programmatically mark checked some items in that multi selection list? I need this cause those selections depends on others fields and conditions.

    TIA,

    Carlos

  • 06-18-2011 01:31 PM In reply to

    Re: Multi selection list in Infopath 2010

    Hi CarlosGoncalves,

    I'm assuming your main data source is populating values from your secondary data source and that the multiple-select list box is bound to your main data source with a data source group and repeating field underneath.

    Here's a sample XML I saved after creating a blank form and adding a multi-select list box to it:

    <my:myFields xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2011-06-18T20:20:53" xml:lang="en-us">
     <my:group1>
      <my:field1></my:field1>
     <my:field1>a</my:field1><my:field1>c</my:field1></my:group1>
    </my:myFields>

    I had three manually entered values in my list box (a, b, and c). I selected a and c and saved the preview as an XML file and opened in notepad.

    So, basically, what you will need to do is to insert fields into your group based on what you want selected.

    You cannot insert fields into your group using regular out-of-box InfoPath rules. You will need to use qRules or write some code.

    In addition, you will need to have some kind of loop that lets you iterate over your secondary data source and copy the values in. That will also require code or the qRules Insert technique.

    I recommend looking at Jo-Anne's tutorial on the qRules Insert technique. I think it could be adapted to solve your problem. qRules trial is a free download, but currently we're upgrading to 3.3 on our web site so we won't have the new trial version out for another week. Please send email to Support <at> Qdabra [dot] com if you interested in trying this.

    Of course, the other approach is to just add some code to your form, but it will be code that won't be reusable for other forms. That's why qRules is worth the small price - it gives you a generic library you can use in all of your InfoPath forms. :) 

    Best of luck!

     

    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.