Populating a drop-down list thru code - InfoPath Dev
in

InfoPath Dev

Populating a drop-down list thru code

Last post 03-28-2007 01:40 AM by B.Shiva Prasad. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 03-26-2007 04:53 AM

    Populating a drop-down list thru code

    Hi All,

    I went thru the article on this forum about how to populate the drop down list via code. The code is working fine except for the fact that the function for populating the dropdown is getting called again and again.. Because of this, i am not able to select a particular values from the dropdown list..

    Could anybody please help ??
    Awaiting reply as soon as possible.
    Regards,
    Anandhi
  • 03-26-2007 06:52 AM In reply to

    Re: Populating a drop-down list thru code

    Hi,

    Where you have written the function(example: Onload and etc..)?
    K.Ramana Reddy / http://www.ggktech.com
    India.
  • 03-26-2007 10:11 PM In reply to

    Re: Populating a drop-down list thru code

    Hello Ramana,

    First of all, thanks a lot for replying. I have shown the code snippet as below.. Please have a look at the same and tell me what to do. My function's name is PopulateDropdown(parameter). As the code that i checked out, it said i need to call it the way i have called here in this snippet.
    Please let me know how can i call this on the load event ?
    This is actually the view1.xsl file that's available in the InfoPath form template project.

    Awaiting reply soon.. Please..

    //--------------- code snippet ----------------------------
    <xsl:template match="my:group1" mode="xd:preserve">
    <div class="xdSection xdRepeating" title="" style="MARGIN-BOTTOM: 6px; WIDTH: 651px" align="left" xd:xctname="Section" xd:CtrlId="CTRL1" tabIndex="-1">
    <div> </div>
    <div>
    <select class="xdComboBox xdBehavior_Select" title="" size="1" xd:xctname="dropdown" xd:CtrlId="CTRL2" tabIndex="0" xd:binding="my:dropDown1" xd:boundProp="value" style="WIDTH: 130px">
    <option>

    <xsl:value-of select="xdExtension:PopulateDropdown(string(my:BoundField))" disable-output-escaping="yes"></xsl:value-of>

    </option>
    </select>

    </div>
    <div> </div>
    </div>
    // ------------------------ snippet ends here ------------------
  • 03-27-2007 04:17 AM In reply to

    Re: Populating a drop-down list thru code

    Hi anandhienator,

    Ramana is asking about, from which event you are calling the method PopulateDropdown. If that event is generating repeatedly the field values will refresh at every time. Check once the events.
    B.Shiva Prasad
    InfoPath Dev,
    http://www.ggktech.com
    India
  • 03-27-2007 07:21 AM In reply to

    Re: Populating a drop-down list thru code

    Hi anandhienator,

    down load the example link "Download fully editable dropdown list box, v1.5" and see the code, you will get the solution.

    http://infopathdev.com/howto/examples/default.aspx?i=0672a57e920b4771b62b1c22d5bd314d
    B.Shiva Prasad
    InfoPath Dev,
    http://www.ggktech.com
    India
  • 03-27-2007 11:51 PM In reply to

    Re: Populating a drop-down list thru code

    Hello Shiva,

    I had a look at the code that u asked me to. But i am coding in C#.net and not scripting. Could you help ??

    Regards,
    Anandhi
  • 03-28-2007 01:40 AM In reply to

    Re: Populating a drop-down list thru code

    Hi anandhienator,

    The logic itself is there in the script only, In that what ever the values you are taking, take those values in the arraylist so that while comparing take the values from arraylist.

    before that do like this, drag the another copy of drop down list box and run the application. the copy of dropdown list box will show your selected item. that the value is saving in the combobox memory.

    So compare the combobox value with the arraylist elements you can get the result.

    Hope this will help you..
    B.Shiva Prasad
    InfoPath Dev,
    http://www.ggktech.com
    India
Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.