in

InfoPath Dev

How to create mutually exclusive List boxes

Last post 07-30-2008 05:34 AM by akash_waits. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 07-29-2008 05:35 AM

    How to create mutually exclusive List boxes

    Hi,

     I have two list boxes in my template and requirement is such that if i will select an item from one listbox1 and if there is some item already selected in the listbox2 then listbox2 will be cleared (means no selected value). And same goes for other case. Means only one selected item at a time from one of the two list boxes. I applied rules on both the list boxes but these rules will clear both list boxes if i try to select some item with an item already selected in other list box.

    Second problem i am facing is that i have applied a rule on a button (which says that if  both the list boxes are empty raise an expression box saying that select an item please.) which is getting fired even before button is clicked. Is this the right functionality for a button rule or i am missing something?

     Third and last, the template i am preparing should be browser based so expression boxes would not work there can you suggest some work around for that please.

     Thanks in advance.

    Akash Kansal.

  • 07-29-2008 06:29 AM In reply to

    • Shiva
    • Top 10 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 602

    Re: How to create mutually exclusive List boxes

    Hello,

    You have to add filter condition for list box like as below:

    Filter on first list box:

    <secondary drop list values node> != <second list box node XPath>

    Filter on second list box:

    <secondary drop list values node> != <first list box node XPath>

  • 07-29-2008 09:30 PM In reply to

    Re: How to create mutually exclusive List boxes

    Hi Shiva,

    Thanks for your information.But I am a bit new to Infopath, so can you please explain a bit how to create filters for the list box and how to use them?

    And any idea about other problems i have mentioned previously?

     Thanks,

    Akash Kansal.

    Filed under: ,
  • 07-30-2008 12:11 AM In reply to

    • Anuma
    • Top 25 Contributor
      Female
    • Joined on 07-20-2005
    • India
    • Posts 317

    Re: How to create mutually exclusive List boxes

    Hi,

     

    For you first question please verify the following steps:

    Read your list box names as Listbox1 and Listbox2. Add Following rule to List box 1.

    1. Select List box properties and select Rules.
    2. Click on add in the Rules window.
    3. Click on “Set Condition” and add condition as “Listbox1 is not blank” and click on ok.
    4. Click on “Add Action” button in the rule window.
    5. Select “Set a Fields value” from action dropdown.
    6. Select “Listbox2 Xpath” in the “field” textbox.
    7. Leave “value” as empty and click on ok.
    8. Add same steps to List box2 also.
     For second question please verify the following steps:

    Add following rule to Button.

    1. In the Rules window set the condition as “Listbox1 is blank” or “Listbox2 is blank”.  And Click on ok
    2. Click on “Add Action” button in the rule window.
    3. Select “Show a Dialog box message” from action dropdown.
    4. Enter your text in “Message” field.
    5. Click on ok.

    For you third question, you can use read-only text boxes instead of expression boxes.

     

    I hope this will help you.

     

    Anuma Reddy / http://www.GGKTech.com
  • 07-30-2008 01:25 AM In reply to

    Re: How to create mutually exclusive List boxes

    Hi Anuma,

    Thanks a ton.  And can you please tell me how to make a entry in list box as default value?

    But regarding third question I was talking about dialog expression box (something like pop up box) not expression box (type of text box).Because in the end, one user must be selected. If no user is selected then we need to show a pop up that "Please select a user". But if we have one user selected by default in one of the list boxes then i will have no need to show that pop up box.

    Thanks once again.

    Akash Kansal.

    Filed under:
  • 07-30-2008 01:50 AM In reply to

    • Anuma
    • Top 25 Contributor
      Female
    • Joined on 07-20-2005
    • India
    • Posts 317

    Re: How to create mutually exclusive List boxes

    Hi,

    Can you please follow the below steps to set the default value in list box.

    1.       Open List box Properties window.2.      In the “List Box Entries” area, select the value which one you have to show the default.3.      Click on “Set Default” button right side of the List box entries.

    I was confused with third question. Sorry for that.  

    I think we cannot show Expression message boxes in the browser forms. One thing you can do is enable the button only when any one of the list box is selected. If no value selected from two values, then disable the button. And also add the Tool tip for button.

    Anuma Reddy / http://www.GGKTech.com
  • 07-30-2008 01:57 AM In reply to

    Re: How to create mutually exclusive List boxes

    Hi,

     But i am populating the list boxes dynamically (i.e. through coding) by pulling data from a data source. So we can't make it default in the way you suggested.

    And how to disable a button??

    Thanks,

    Akash Kansal.

    Filed under:
  • 07-30-2008 03:16 AM In reply to

    • Anuma
    • Top 25 Contributor
      Female
    • Joined on 07-20-2005
    • India
    • Posts 317

    Re: How to create mutually exclusive List boxes

    Hi,

    Can you please follow the below steps to set default value:

    1. Click on list box node name from data source.
    2. In the List box properties window select “fx” button under the default value window.
    3. Click on “Insert Field or Group” button and select your secondary data source from Data source dropdown.
    4. Select Field Name [From which field you are getting data from].
    5. Click on ok.

    Can you follow the below steps to disable the button:

    1. Double click on the button and in the display tab select conditional formatting.
    2. Select Add and add following conditions: “Listbox1 is blank” or “Listbox2 is blank”. 
    3. Select “Disable this Control” check box and click on ok.
    Anuma Reddy / http://www.GGKTech.com
  • 07-30-2008 05:34 AM In reply to

    Re: How to create mutually exclusive List boxes

    Hi Anuma,

     Thanks a ton with your help i was able to accomlish my goal.Thanks a lot.

    Akash Kansal.

    Filed under:
Page 1 of 1 (9 items)
Copyright © 2003-2007 Qdabra Software. All rights reserved.
View our Terms of Use.