Hello
I am trying to create "IsDirty" logic for each field in my form. I want to create a sub-routine that will create an attribute on a field if it doesn't already exist and set the value to true.. I plan to call the sub on field change.. I keep getting schema validation errors as thought it had the nil attribute.. Can an attribute have an attribute?? Why would it be nil if I am supplying a value upon creation?? How do I add an attribute to a field via VB code?
The code for thesub is below:
Public Sub Dirty_Changed(ByVal sender As Object, ByVal e As XmlEventArgs)
If Not Me.SQLLoadActive Then
Dim dom As XPathNavigator = MainDataSource.CreateNavigator()
Select Case dom.SelectSingleNode("/my:myFields/my:RequestInfo/my:RequestType", NamespaceManager).Value
Case "Add"
Case "Change"
If e.NewValue <> e.OldValue Then
e.Site.CreateAttribute(e.Site.Prefix, "IsDirty", NamespaceManager.LookupNamespace("my"), System.String.Empty)
MessageBox.Show(e.Site.Name & " - " & e.OldValue & " - " & e.NewValue)
End If
Case "Obsolete"
End Select
End If
End Sub