I currently have an InfoPath 2003 form that pulls in data from a secondary data source through the use of a list box. The form is set up so that the form user can select items from the list box by hitting a button for each selection. As each selection is made there is a repeating table on the form that gets populated programmatically row by row. I have this part mostly working fine. However, I am missing the ability to add some conditional formatting. Based on the list box values, I want to change the background color of each row in the repeating table as they are added programmatically. Each different choice could have a different color that is associated with it and the desired resulting table may end up with many colors.
Below is the current jscript code for the button that is working minus the background color formatting.
function CTRL5_5::OnClick(eventObj) {
// each tine the button is selected a new row is added to the repeating table for the principle selected. The text is updated to match the text from the drop down.
var parent = XDocument.DOM.selectSingleNode("/my:myFields/my:group4");
var rowOne = parent.selectSingleNode("./my:group5");
var rowClone = rowOne.cloneNode(true);
var f9 = rowClone.selectSingleNode("my:principleSelected");
var principleVal = eventObj.Source.selectSingleNode("//my:principlesLB").text;
// The text is updated to match the text from the drop down
f9.text = principleVal parent.appendChild(rowClone);
// the starting sample row is removed
var ss = rowOne.text.substr(4, 6);
if (ss == "Sample") {
parent.removeChild(rowOne);
}
}
If anyone knows how or if I can add the ability to add some conditional formatting for background color based on the list box value selection, it would be very helpful.
Thanks.