Can i add a control dynamically in Onload event (using Infopath 2003) - InfoPath Dev
in

InfoPath Dev

Can i add a control dynamically in Onload event (using Infopath 2003)

Last post 06-10-2009 04:04 AM by Harsh. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 06-09-2009 11:14 PM

    • Harsh
    • Not Ranked
      Male
    • Joined on 06-09-2009
    • Gurganon
    • Posts 6

    Can i add a control dynamically in Onload event (using Infopath 2003)

    Hi,
    I need to show all items of a dropdown in diffrent row.Each row is dynamic and contain a dropdown with ith element selected.
    For eg. If my dropdown is fetching 3 items A,B and C from DB in OnLoad event then i need to show 3 rows first with A selected,second with B selected and 3rd with C selected in OnLoad event.

    Is it possible in Infopath 2003 or 2007???
    I think i would manage if there is any way to dynamically add any control in infopath.

    Thanks
    Harsh Vardhan Saini

     

     

     

  • 06-10-2009 12:02 AM In reply to

    Re: Can i add a control dynamically in Onload event (using Infopath 2003)

    Hi

    Add a repeating field in schema and put rule for repeating field that if the drop down fetches zero rows then hide repeating field.

    Add an on after change event for the field. And get the repeating node from the sample xml and add it to the parent group node of repeating field.

    Refer this for more:

    http://www.infopathdev.com/forums/p/10129/36002.aspx#36002

    Hope this helps.

     

    Rajitha
  • 06-10-2009 04:04 AM In reply to

    • Harsh
    • Not Ranked
      Male
    • Joined on 06-09-2009
    • Gurganon
    • Posts 6

    Re: Can i add a control dynamically in Onload event (using Infopath 2003)

    Hi,
    Thanks for the reply. i have solved half problem by the following code. I can loop that code i times so i will get i rows.This is working fine for me.

    Dim parent
    Dim child
    dim rowClone
    Set parent =XDocument.DOM.selectSingleNode("/my:myFields/my:group23")
    Set child = XDocument.DOM.selectSingleNode("/my:myFields/my:group23/my:group24")
    Set rowClone= child.cloneNode(true)
    'rowClone.selectSingleNode("my:txtAA").text ="aa"
    'rowClone.selectSingleNode("my:txtBB").text ="BB"
    'rowClone.selectSingleNode("my:txtDD").text ="CC"
    Call parent.appendChild(rowClone)

     Now the problem is that  i need to show the dropdowns selected as i described.


    So the problem changed to 'how to show desired selected item in dropdown'
    DO anyone one have its answer ??


    Thanks
    Harsh

     

     

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