InfoPath 2007/2010: Manually fill dropdown list by JScript RRS feed

  • Question

  • Dear MSDN,

    I would like to manually fill a dropdown list inside my InfoPath template by using JScript code. I have searched everywhere on the web but I can not find any solution. I have managed to get it as far as this:

    var cbDep = XDocument.DOM.selectSingleNode("my:Fields/my:Department");
    var node = cbDep.cloneNode(true);
    node.text = "test";

    But this will result in the follwing error:

    "Element '{}Department' is unexpected according to content model of parent element '}Department'.

    Can someone help me out? this can not be that hard right?

    Kind reqards,


    Friday, January 6, 2012 12:39 PM


  • Hello Mike,
    Thanks for posting. Actually, in this forum, there are also few experts on Infopath programming issues. To get more help about Infopath programming issues, I recommend you could try to ask in Answer site. Although that answer site is for end-user issues, you will also find more Infopath specialists on programing issues. 

    However, please have a look at this kb article to see whether it can help you:
    If you have any concern on this post, just feel free to follow up. Thanks for your understanding. Have a nice day.

    Best Regards,

    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    • Edited by Bruce Song Monday, January 9, 2012 9:30 AM
    • Marked as answer by Bruce Song Wednesday, January 18, 2012 6:05 AM
    Monday, January 9, 2012 9:30 AM