Username in InfoPath

J

Jerusik

when I create an InfoPath 2003form going through Visual Studio, I can put the
following code in the OnLoad event handler and access the username without
any problems. (Formatting changed to conserve space)

IXMLDOMNode nodeEmployee =
thisXDocument.DOM.selectSingleNode("my:myFields/my:employee");
if(nodeEmployee != null)
{ if(nodeEmployee.text == "")
{ nodeEmployee.text = System.Environment.UserName;
} }

Repeating the process in a from created by opening InfoPath 2003 directcly,
I get the following error when I preview the form:

Expected ';'
File:script.js
Line:27
IXMLDOMNode nodeEmployee =

Does anyone have any ideas? I have tried everything but the right one. Thanks.
 
S

Scott L. Heim [MSFT]

Hi,

Unfortunately I am unable to repro an error where I get a "script.js" error
when I have a .NET solution. For instance, I created a new InfoPath form
and added some invalid jscript code (left off the semi-colon) to the form.
I then created a new .NET InfoPath solution but chose to use the template I
had created above and cannot repro the error.

Are you working with the same forms? What happens if you drill down to the
Debug/bin folder for your InfoPath solution and double-click that XSN
file...what are the results?

Best Regards,

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

Jerusik

Thanks for the response Scott. I am still having a problem but right now it
isn't a pressing matter. I will attempt to resolve it at a later date. I am
about to post another question now.

Jerry
 

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