Multiple Conditions to "un-Disable" control - InfoPath Dev
in

InfoPath Dev

Multiple Conditions to "un-Disable" control

Last post 07-25-2012 06:18 AM by JChalhub. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 07-23-2012 07:59 AM

    Multiple Conditions to "un-Disable" control

    I have a checkbox that I want disabled unless one the following combinations is true:

    • Textbox1 has a value of A and Dropdownlist1 has a value of X OR
    • Textbox1 has a value of B and Dropdownlist1 has a value of Y OR
    • Textbox1 has a value of C and Dropdownlist1 has a value of Z

    I've tried individual rules for these or combining it into one expression such as ‘if the following isn't true, then disable the checkbox’:

     (../Textbox1 != "A" and ../Dropdownlist1 != "X") or (../Textbox1 != "B" and ../Dropdownlist1 != "Y") or (../Textbox1 != "C" and ../Dropdownlist1 != "Z")

     It would be so much easier to have en "enable" option, but I realize there's not and I have to reverse engineer this using not equals instead of equals.

    Any advice on how to achieve this? Would really appreciate it!

  • 07-23-2012 08:30 AM In reply to

    Re: Multiple Conditions to "un-Disable" control

    I think you've nearly done it... I think you need AND instead of OR between the brackets of your long expression. You need all the bits in brackets to be true (by being not true) to hide the control.

    The backwards conditional formatting in InfoPath gives me a headache!

  • 07-25-2012 04:46 AM In reply to

    Re: Multiple Conditions to "un-Disable" control

    Thanks for your response! Unfortunatley, swapping the ORs for ANDs didn't work. Any other ideas? Appreciate your input!

  • 07-25-2012 05:32 AM In reply to

    Re: Multiple Conditions to "un-Disable" control

    In addition to swapping the ORs with ANDs, please switch the ANDs with ORs:

    (../Textbox1 != "A" or ../Dropdownlist1 != "X") and (../Textbox1 != "B" or ../Dropdownlist1 != "Y") and (../Textbox1 != "C" or ../Dropdownlist1 != "Z")

    It is somewhat mind bending, but you can make sense of it all by applying DeMorgan's laws to the not() of your Enable expression.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 07-25-2012 06:18 AM In reply to

    Re: Multiple Conditions to "un-Disable" control

    Jimmy - you're a genius! Thanks for that link too! Worked like a charm!

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