Dynamic Textbox Reference Based on User Selection of Radio Buttons - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Dynamic Textbox Reference Based on User Selection of Radio Buttons

Last post 11-06-2015 08:22 AM by vikas Sharma. 11 replies.
Page 1 of 1 (12 items)
Sort Posts: Previous Next
  • 10-23-2013 02:33 PM

    • dtklos
    • Not Ranked
    • Joined on 10-23-2013
    • Posts 6

    Dynamic Textbox Reference Based on User Selection of Radio Buttons

    Trying to figure out if it's possible to dynamically reference a field name with a control result via formula. I currently have 5 radio buttons that return integers 1-5. Next to each radio button is a text box with a text value. If the user clicks a radio button, it should pass the corresponding text value to a "Result" textbox on a different view. For example, if RadioButton3 is clicked, then the "Result" textbox should be set to the value of Textbox3.

    So far I have a rule set on the radio button change event, with an XPath along the lines of "concat(Textbox, .)", which currently returns a string of "Textbox3" rather than the actual text located in Textbox3. Am I looking at this problem the right way, or is there an easier method?

    Thanks in advance.
  • 10-23-2013 04:37 PM In reply to

    Re: Dynamic Textbox Reference Based on User Selection of Radio Buttons

    Fun! I have attached a sample that shows 2 ways to do this (save the file locally, right click and select design to open in design mode, from there you can preview / look at the logic). In one view I am using a set of field with rules on field1 to set the field called Result. In the other view, I have no rules, but am using a default value for ResultXPath that has the same effect.

    Hilary Stoupa

  • 10-24-2013 06:01 AM In reply to

    • dtklos
    • Not Ranked
    • Joined on 10-23-2013
    • Posts 6

    Re: Dynamic Textbox Reference Based on User Selection of Radio Buttons

    I don't see the attachment. How do I access it?
  • 10-24-2013 07:52 AM In reply to

    Re: Dynamic Textbox Reference Based on User Selection of Radio Buttons

     Sorry - I failed to actually attach the file. You should see a link in the heading to this post.

    Hilary Stoupa

  • 10-24-2013 09:18 AM In reply to

    • dtklos
    • Not Ranked
    • Joined on 10-23-2013
    • Posts 6

    Re: Dynamic Textbox Reference Based on User Selection of Radio Buttons

    Downloaded and reviewed, I think the second example (XPath) is what I'm looking for. I tried using the same syntax on my form, but it didn't seem to work. Does the fact that the radio buttons and textbox are on different views matter?
  • 10-24-2013 09:27 AM In reply to

    Re: Dynamic Textbox Reference Based on User Selection of Radio Buttons

     No - views and data are separate. You can use controls bound to the same field in multiple views or in multiple places in the same view. Did you check "Edit XPath" in the formula editor so you could see the entire XPath? If you need a hand attach your form under the options tab - I should have a few minutes to help you out later today.

    Hilary Stoupa

  • 10-24-2013 09:57 AM In reply to

    • dtklos
    • Not Ranked
    • Joined on 10-23-2013
    • Posts 6

    Re: Dynamic Textbox Reference Based on User Selection of Radio Buttons

    All right, I've attached my form here. You can ignore the top section and Storage/Thermal Shock rows, I'm currently working with the "Operating" row in the Temperature section.

    Expected functionality:

    When a radio button is selected on the "ViewTestSelection" view, the boxes on "ViewTestOrder" will update accordingly. field67 should update with the appropriate column title (e.g. "Level 1", "Level 4", "User Defined", etc). field68 should update with the appropriate temperature range (40C to 125C, 25C to 80C, etc).

    I tried to match the syntax of your example as well as possible, by setting the default values of field67 and field68. However, the fields remain blank, even after selecting the radio button options.

    Please let me know what you find out.
  • 10-24-2013 10:41 AM In reply to

    Re: Dynamic Textbox Reference Based on User Selection of Radio Buttons

     My sample had a super simple schema. Check the default on field68 in the attached file. Be sure to check the edit XPath box in the formula editor, you'll be able to see what I did from there.

    Hilary Stoupa

  • 10-24-2013 10:55 AM In reply to

    • dtklos
    • Not Ranked
    • Joined on 10-23-2013
    • Posts 6

    Re: Dynamic Textbox Reference Based on User Selection of Radio Buttons

    It works! Thank you so much!

    So the solution was just adding a bit more schema to reference the other view, in order to access the appropriate controls?
  • 10-24-2013 11:01 AM In reply to

    Re: Dynamic Textbox Reference Based on User Selection of Radio Buttons

     Nothing to do with the view, but everything to do with the XPath. I'm using an absolute reference to the node bound to the radio button instead of a relative reference and that seemed to do the trick.

    Hilary Stoupa

  • 10-24-2013 11:24 AM In reply to

    • dtklos
    • Not Ranked
    • Joined on 10-23-2013
    • Posts 6

    Re: Dynamic Textbox Reference Based on User Selection of Radio Buttons

    Awesome, thank you again for the assistance!
  • 11-06-2015 08:22 AM In reply to

    Re: Dynamic Textbox Reference Based on User Selection of Radio Buttons

    HI Hilary Stoupa, I have an issue please help! In infopath Form i have one option group that contains two option button.I am creating the pdf form using isharptext dll . I want to reference same to that pdf form. Pdf form contains different field values for each option box. thanks!!
Page 1 of 1 (12 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.