How can I set a value in a field based on a combination of radio button values - InfoPath Dev
in

InfoPath Dev

How can I set a value in a field based on a combination of radio button values

Last post 09-14-2011 01:48 PM by Doreen. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 09-14-2011 10:00 AM

    • Doreen
    • Top 50 Contributor
      Female
    • Joined on 08-11-2010
    • Federal Way, WA
    • Posts 291

    How can I set a value in a field based on a combination of radio button values

    I have 3 sets of 2 (Yes, No) radio buttons on a form (IP 2007).  Depending on the combination of results, I want to set a value in a fourth text field.  Radio button are set with data type boolean; value = 1 (for Yes selection) and value= 0 (for No selection).

    For example

    if

    radio button #1 = Yes

    radio button #2 = Yes

    radio button #3 = No

    then

    txtField4 = "Value1"  

    Corresponding rule on txtField4 property is: if txtField4 is blank and rdo1 = 1 and rdo2 = 1 and rdo3 = 0 then set value of txtField4 = "Value1". 

    I can't get it to work with one condition yet

  • 09-14-2011 12:36 PM In reply to

    • Doreen
    • Top 50 Contributor
      Female
    • Joined on 08-11-2010
    • Federal Way, WA
    • Posts 291

    Re: How can I set a value in a field based on a combination of radio button values

    I found a solution although it doesn't make sense to me and I am leary that something weird is going to happen later.  I had to set the exact same rules on each control to make it work.  And interestingly enough, the value that is display in my txtField4 comes from the rule placed in the txtField4 rule.  I named the values slightly different for each control to see which one controled the display value. 

    I still would appreciate anyone's comments on why this only works like this.

  • 09-14-2011 12:50 PM In reply to

    Re: How can I set a value in a field based on a combination of radio button values

    Rules only execute when the field they are attached to changes its value.  If the user could change the radio buttons in any order, then all of the radio button fields will need to have rules.  Or you could put the rules on a button or something that the user clicks after selecting the option buttons.

    Rules on a field that never gets modified will never execute.  That's why the txtField4 rule only executes when some other field changes the value on txtField4 (I'm presuming that's what's happening here).

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 09-14-2011 01:48 PM In reply to

    • Doreen
    • Top 50 Contributor
      Female
    • Joined on 08-11-2010
    • Federal Way, WA
    • Posts 291

    Re: How can I set a value in a field based on a combination of radio button values

    Oh I see that makes sense!  I thought about using a button to set the text field value after the radio selections are set but I didn't want to make the user do more work.  Thank you for explaining this to me.
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.