Can't submit Rich Text to Sharepoint from Infopath

T

toobukume

I've created an Infopath form that submits it's fields to a Sharepoint
list. The form actually does work and submits data. The rich text
field I created will upload it's fields however, the rich text
formatting is not kept (say I set a few words in red, some in blue,
some in a different font; when I go to view the uploaded fields on the
sharepoint site, they all appear standard font black)

What I'm ulimately trying to do is use the rich text field on a tablet
pc so that it can take someone's signature and upload it to
sharepoint. this is actually going to be an electronic service ticket
for an IT company. right now, we have a paper form where we fill out
the details of what we did for the client and the client signs the
form at the bottom.

How my form is setup:

I have a form built in InfoPath 2007. It contains a few text boxes and
one rich text field.

I have an XML file with the field list:
=======================================================================
<?xml version="1.0" encoding="UTF-8" ?>
<Batch>
<Method ID="1" Cmd="New">
<Field Name="Title" />
<Field Name="FirstName" />
<Field Name="LastName" />
<Field Name="Email" />
<Field Name="Phone" />
<Field Name="Sig" />
</Method>
</Batch>
=======================================================================

I have this Visual Basic Script attached to the "Add" button at the
bottom of the script:
=======================================================================
Imports Microsoft.Office.InfoPath
Imports System
Imports System.Xml
Imports System.Xml.XPath
Imports System.Windows.Forms
Imports mshtml



Namespace uptest
Public Class FormCode
' Member variables are not supported in browser-enabled forms.
' Instead, write and read these values from the FormState
' dictionary using code such as the following:
'
' Private Property _memberVariable() As Object
' Get
' _memberVariable = FormState("_memberVariable")
' End Get
' Set
' FormState("_memberVariable") = value
' End Set
' End Property

' NOTE: The following procedure is required by Microsoft
Office InfoPath.
' It can be modified using Microsoft Office InfoPath.
Private Sub InternalStartup(ByVal sender As Object, ByVal e As
EventArgs) Handles Me.Startup
AddHandler
DirectCast(EventManager.ControlEvents("CTRL14_5"),
ButtonEvent).Clicked, AddressOf CTRL14_5_Clicked
End Sub

Public Sub CTRL14_5_Clicked(ByVal sender As Object, ByVal e As
ClickedEventArgs)
Dim root As XPathNavigator =
MainDataSource.CreateNavigator()

' Retrieve the values
Dim Title = root.SelectSingleNode("my:myFields/my:Title",
NamespaceManager).Value
Dim FirstName = root.SelectSingleNode("my:myFields/
my:FirstName", NamespaceManager).Value
Dim LastName = root.SelectSingleNode("my:myFields/
my:LastName", NamespaceManager).Value
Dim Email = root.SelectSingleNode("my:myFields/my:Email",
NamespaceManager).Value
Dim Phone = root.SelectSingleNode("my:myFields/my:phone",
NamespaceManager).Value
Dim Sig As Object = root.SelectSingleNode("my:myFields/
my:Sig", NamespaceManager).Value

Dim batch As XPathNavigator =
DataSources("XML").CreateNavigator()

' Set the Title
batch.SelectSingleNode("/Batch/Method/
Field[@Name='Title']", _
NamespaceManager).SetValue(Title)

' Set the FirstName
batch.SelectSingleNode("/Batch/Method/
Field[@Name='FirstName']", _
NamespaceManager).SetValue(FirstName)

' Set the LastName
batch.SelectSingleNode("/Batch/Method/
Field[@Name='LastName']", _
NamespaceManager).SetValue(LastName)

' Set the Email
batch.SelectSingleNode("/Batch/Method/
Field[@Name='Email']", _
NamespaceManager).SetValue(Email)

' Set the Phone
batch.SelectSingleNode("/Batch/Method/
Field[@Name='Phone']", _
NamespaceManager).SetValue(Phone)

' Set the Sig
batch.SelectSingleNode("/Batch/Method/Field[@Name='Sig']",
_
NamespaceManager).SetValue(Sig)

' Submit the item details
DataConnections("Submit to Sharepoint").Execute()
End Sub
End Class
End Namespace
=======================================================================

Could someone please tell me what I need to do in order for Sharepoint
(2007) to accept my rich text field?
 
S

S.Y.M. Wong-A-Ton

From your code I cannot see which field is the rich text field, but when you
are retrieving the values of the fields use .InnerXml for the rich text field
instead of .Value and see if that helps.
---
S.Y.M. Wong-A-Ton


I've created an Infopath form that submits it's fields to a Sharepoint
list. The form actually does work and submits data. The rich text
field I created will upload it's fields however, the rich text
formatting is not kept (say I set a few words in red, some in blue,
some in a different font; when I go to view the uploaded fields on the
sharepoint site, they all appear standard font black)

What I'm ulimately trying to do is use the rich text field on a tablet
pc so that it can take someone's signature and upload it to
sharepoint. this is actually going to be an electronic service ticket
for an IT company. right now, we have a paper form where we fill out
the details of what we did for the client and the client signs the
form at the bottom.

How my form is setup:

I have a form built in InfoPath 2007. It contains a few text boxes and
one rich text field.

I have an XML file with the field list:
=======================================================================
<?xml version="1.0" encoding="UTF-8" ?>
<Batch>
<Method ID="1" Cmd="New">
<Field Name="Title" />
<Field Name="FirstName" />
<Field Name="LastName" />
<Field Name="Email" />
<Field Name="Phone" />
<Field Name="Sig" />
</Method>
</Batch>
=======================================================================

I have this Visual Basic Script attached to the "Add" button at the
bottom of the script:
=======================================================================
Imports Microsoft.Office.InfoPath
Imports System
Imports System.Xml
Imports System.Xml.XPath
Imports System.Windows.Forms
Imports mshtml



Namespace uptest
Public Class FormCode
' Member variables are not supported in browser-enabled forms.
' Instead, write and read these values from the FormState
' dictionary using code such as the following:
'
' Private Property _memberVariable() As Object
' Get
' _memberVariable = FormState("_memberVariable")
' End Get
' Set
' FormState("_memberVariable") = value
' End Set
' End Property

' NOTE: The following procedure is required by Microsoft
Office InfoPath.
' It can be modified using Microsoft Office InfoPath.
Private Sub InternalStartup(ByVal sender As Object, ByVal e As
EventArgs) Handles Me.Startup
AddHandler
DirectCast(EventManager.ControlEvents("CTRL14_5"),
ButtonEvent).Clicked, AddressOf CTRL14_5_Clicked
End Sub

Public Sub CTRL14_5_Clicked(ByVal sender As Object, ByVal e As
ClickedEventArgs)
Dim root As XPathNavigator =
MainDataSource.CreateNavigator()

' Retrieve the values
Dim Title = root.SelectSingleNode("my:myFields/my:Title",
NamespaceManager).Value
Dim FirstName = root.SelectSingleNode("my:myFields/
my:FirstName", NamespaceManager).Value
Dim LastName = root.SelectSingleNode("my:myFields/
my:LastName", NamespaceManager).Value
Dim Email = root.SelectSingleNode("my:myFields/my:Email",
NamespaceManager).Value
Dim Phone = root.SelectSingleNode("my:myFields/my:phone",
NamespaceManager).Value
Dim Sig As Object = root.SelectSingleNode("my:myFields/
my:Sig", NamespaceManager).Value

Dim batch As XPathNavigator =
DataSources("XML").CreateNavigator()

' Set the Title
batch.SelectSingleNode("/Batch/Method/
Field[@Name='Title']", _
NamespaceManager).SetValue(Title)

' Set the FirstName
batch.SelectSingleNode("/Batch/Method/
Field[@Name='FirstName']", _
NamespaceManager).SetValue(FirstName)

' Set the LastName
batch.SelectSingleNode("/Batch/Method/
Field[@Name='LastName']", _
NamespaceManager).SetValue(LastName)

' Set the Email
batch.SelectSingleNode("/Batch/Method/
Field[@Name='Email']", _
NamespaceManager).SetValue(Email)

' Set the Phone
batch.SelectSingleNode("/Batch/Method/
Field[@Name='Phone']", _
NamespaceManager).SetValue(Phone)

' Set the Sig
batch.SelectSingleNode("/Batch/Method/Field[@Name='Sig']",
_
NamespaceManager).SetValue(Sig)

' Submit the item details
DataConnections("Submit to Sharepoint").Execute()
End Sub
End Class
End Namespace
=======================================================================

Could someone please tell me what I need to do in order for Sharepoint
(2007) to accept my rich text field?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top