Dear Jimmy,
many thanks to you for helping me out, I now have this code behind my button, where SmartKey is the name of the Field (it is XHTML formated Richtext):
function CTRL9_5::OnClick(eventObj)
{
XPathNavigator nodeToCopy = MainDataSource.CreateNavigator().SelectSingleNode("my:myFields/my:SmartKey", NamespaceManager);
if (!string.IsNullOrEmpty(nodeToCopy.Value))
{
Clipboard.SetText(nodeToCopy.Value, TextDataFormat.Text);
}
else
{
MessageBox.Show("There is no text to copy!");
}
}
And it is automatically stored in script.js - this was already there as I double clicked the button to add my custom code and it said where to put it to...
But I'm getting an error with this:
Form template: https://my.sharepoint.com/test/SmartKeyLibrary/Forms/template.xsn
InfoPath cannot open the selected form because of an error in the form's code.
The following error occurred:
Expected ';'
File:script.js
Line:24
XPathNavigator nodeToCopy = MainDataSource.CreateNavigator().SelectSingleNode("my:myFields/my:SmartKey", NamespaceManager);
What I'm doing wrong?
Many thanks again for your help!
Joerg