Conditional statetment for controls... - InfoPath Dev
in

InfoPath Dev

Conditional statetment for controls...

Last post 10-30-2008 02:29 AM by pablavo. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 10-29-2008 07:33 AM

    Conditional statetment for controls...

    Hi folks,

    Hope someone can help.  I'm fairly new with InfoPath and I've got a question about controls.

    Im going to use arbitrary names for simplicity. 

    There is a drop down list on my form. When a selection is made I'd like 4 other text boxes to show related values depending on the selection made. a bit like a case or If... then statement in Access.
    I really don't know if this is possible. really what's happening is, the text boxes are using a lookup table from the database and the code (or another method) will insert the values into the form, when submitted, the correct values that are related to the drop down value will be added to the database.

     Does anyone know if this is possible?  If you need more info let me know. I've put an VBA case statement below to clarify what I mean to do.

     study = Me.StudyID 'Drop down list'

        Select Case study
            Case 1
                Me.Milestone1 = 1 'Text boxes'
                Me.Milestone2 = 2
                Me.Milestone3 = 3

            Case 2
                Me.Milestone1 = 4
                Me.Milestone2 = 5
                Me.Milestone3 = 6
            Case 3
                Me.Milestone1 = 8
                Me.Milestone2 = 9
                Me.Milestone3 = 10
               
               
      Me.Milestone1.Requery
      Me.Milestone2.Requery
      Me.Milestone3.Requery
        End Select

     

    ____________________________________

    Take a deep breath phsssssssssss
  • 10-29-2008 10:46 PM In reply to

    Re: Conditional statetment for controls...

    Hi, 

    Here is the link to populate the values depending on the selection of dropdown with out using code.http://www.infopathdev.com/blogs/matt/archive/2006/04/18/Automatically-Populate-Fields-from-a-Drop_2D00_Down-Selection.aspxHope this helps you.

     

    Rajitha
  • 10-29-2008 11:55 PM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: Conditional statetment for controls...

    Hello,

    If you want set the 4 text box values depending on the selection using code follow this steps.

    Insert onAfterChange event for dropdown field.

    In onAfterChange event you have to write the below code,

    string dropdownValue = e.site.Value;

    //Secondary DOM is contains of text box values

    //Get the textbox1 value form secondary dom

    string textbox1Value = secondaryDOM.selectSingleNode(string.Format("<XPath of your field>",  dropdownValue));

    //Setting the value to text box1

    XDocument.DOM.selectSingleNode("<XPath of textbox1>").text = textbox1Value;

    Note: Like this you can write for 4 text box values.

  • 10-30-2008 02:29 AM In reply to

    Re: Conditional statetment for controls...

    I'm very pleased I found this site, thanks for all your help folks, I'll give both a try a and tell you how I got on...

     Paul

    ____________________________________

    Take a deep breath phsssssssssss
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.