Browser-Enabled Form - Dropdown HTML Values - InfoPath Dev
in

InfoPath Dev

Having trouble finding a blog or post that answers your question? Check out our Custom Search Page

Browser-Enabled Form - Dropdown HTML Values

Last post 03-03-2009 12:42 PM by munzili. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 03-03-2009 12:42 PM

    Browser-Enabled Form - Dropdown HTML Values

    Hi!

    I'm adding in an browser-enabled InfoPath Form dynamically with C# items, which works correctly.

    I setted the DropDown Source to Fields of the Form ( MainSource ). Via C# OnLoad() event i add my items dynaicaly:

                     //-- set value of dropdown item
                    tempNode.SelectSingleNode("my:" + XPathField + "Value", IPForm.NamespaceManager).SetValue(searchResult[i][valueField].ToString());

                    textBuilder = new StringBuilder();
                   
                    //-- create text of dropdown item by creating multi-column text values, splited by "|"
                    for(int k = 0; k < textFields.Length; k++)  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// THIS CREATES THE TEXT VALUE, WHICH GETS DISPLAY, DYNAMICALY. EXAMPLE VALUE: 1 | blabla&nbsp;&nbsp;&nbsp;&nbsp; | ASDF
                    {
                        fieldValue = searchResult[i][textFields[k]].ToString();

                        toAdd = maxLength[k] - fieldValue.Length;
                        fieldValue += string.Join("", (string[])ArrayList.Repeat("&nbsp;", toAdd).ToArray(typeof(string))); ////////////////////////////////////////////////////// THIS JUST ADDS &NBSP; TO THE VALUES END, SO IT MACHTES THE SAME LENGTH AS ALL OTHER FIELDS
                        //fieldValue = fieldValue.PadRight(maxLength[k], ' '); //-- verify the text values have all the same size so the layout is ok
                        textBuilder.AppendFormat(" {0} |", fieldValue);
                       
                    }

                    //-- get final text value string
                    fieldValue = textBuilder.ToString();
                    fieldValue = fieldValue.Substring(0, fieldValue.Length - 1).Trim();

                    //-- set text value
                    tempNode.SelectSingleNode("my:" + XPathField + "Text", IPForm.NamespaceManager).SetValue(fieldValue);  
                   
                    //-- add new dropdownlist-item to the field
                    mainGroup.AppendChild(tempNode);

     My Problem is now, that InfoPath encodes the setted Text Value. The outputted JavaScript Code with the values shows ( InfoPath HTML encodes the value &nbsp; to  &amp;nbsp;) :

               ["","","1250","1250 | BLABLA&amp;nbsp;&amp;nbsp; | 1","1296","1296 | asdf&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | 1","1294","1294 | asdfasf&amp;nbsp;&amp;nbsp;&amp;nbsp; | 1"]

    Does Anybode know how to awoid this?

     Thanks!

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