tags:

views:

312

answers:

1

I have a textfield within a repeating table. I am able to validate what's inside but if the text does not pass my validation it should change it's color to red.

Does anybody know how I can achieve this goal by code?

I have found a solution for a rich text box by setting the innerXml to the following:

"This is just a piece of <span xmlns="http://www.w3.org/1999/xhtml" style="color:red">red text</span>."

Unfortunately this does'nt work. An namespace error occurs :/ But even if this would work, I don't want to have a richt text box since the textfield within the InfoPath form should not have the "menu" above the field.

A: 

Maybe a compomise:

Set up a bool field in your primary DataSource (FieldXYValid). Create a rule to set Textfield color red if FieldXYValid is false.

Set the value of FieldXYValid in the C# code after validation.

Hinek