Question

I need to set up infopath screentip programmatically in infopath code behind. I read something about this that it is impossible but, i made something like this:

        XPathNavigator field1 = MainDataSource.CreateNavigator().SelectSingleNode(xpath1, NamespaceManager);

        XPathNavigator field2 = MainDataSource.CreateNavigator().SelectSingleNode(xpath2, NamespaceManager);

        if (field1.Value.ToString() == "none")
        {

            this.Errors.Add(field2, "XXX", "XXxxxXX", "xxXXxxXX");

        }

but still i change the field to "cannot be blank" any clue ?

Était-ce utile?

La solution 2

I created button and special field with hide when value = true , and show when is true.

public void CTRL32_7_Clicked(object sender, ClickedEventArgs e) { // XPathNavigator test = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:field11", NamespaceManager);

        XPathNavigator test2 = MainDataSource.CreateNavigator().SelectSingleNode("my:myFields/my:buttonSet", NamespaceManager);
        if (test2.Value == "FALSE")
        {
            test2.SetValue("TRUE");
        }
        else
        {
            test2.SetValue("FALSE");
        }
        XPathNavigator tooltip = MainDataSource.CreateNavigator().SelectSingleNode("my:myFields/my:tooltip", NamespaceManager);
        tooltip.SetValue("Custom Tooltip DEMO");
    }

Autres conseils

I faced the exact same problem like you and didn't really find an easy and clean solution. I had to check if an IBAN was entered correctly. Working with extra fields and methods is not clean enough for me so I went and tried it through the Errors-property, which you say doesn't work. Here's the code I used:

XPathNavigator navigator = MainDataSource.CreateNavigator();
XPathNavigator ibanField = navigator.SelectSingleNode("/my:.../my:.../my:FldIban", NamespaceManager);
Errors.Add(ibanField , "Invalid IBAN", "The given IBAN is not formatted correctly");

Hope this helps anyway, it did for me. :)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top