InfoPath & MOSS Loading Event

P

Pete M

Hi There,

I need to create a loading event for my Infopath form which does the
following:

Checks if an infopath "filename" field is already populated.
If it is, then do nothing
If the "filename" field is not populated then set it to a unique title.
We've currently been using daymonthyearhourminuteseconds as the filename
(Due to issues using the @ID List item)

Would someone be able to come up with a working code?

Many Thanks
 
B

Ben Walters

Hey Pete,
This shouldn't be too difficult, the code would look like this

XPathNavigator Main = this.CreateNavigator();
if(XPathNavigator.SelectSingleNode("my:myFields/my:Filename",this.NamespaceManager).Value
== string.empty)
{
XPathNavigator.SelectSingleNode("my:myFields/my:Filename",this.NamespaceManager).SetValue(DateTime.Now.Ticks.ToString());
}
 

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