A
abc
Hi
I am struggling to access a field using JScript from an aspx web page.
I am basically following the instructions here:
http://blogs.msdn.com/rrawat/archive/2006/08/09/693118.aspx
When my code runs I get the message
Reference to undeclared namespace prefix: 'my'.
My code is:
<script language=jscript>
var oApp = new ActiveXObject("InfoPath.Application");
var oXDocument = oApp.XDocuments.NewFromSolution("http://abc999/
Template1.xsn");
var oParam = oXDocument.DOM.selectSingleNode("//my:TestPram")
alert(oParam.text);
oApp = null;
</script>
I created the field TestPram in my InfoPath form by right clicking
MyFields, clicking Add, typed the name TestPram and clicked OK.
This prefix exists because if I run:
alert(oXDocument.DOM.xml);
I get the following output:
<?xml version="1.0"?>
<?mso-infoPathSolution solutionVersion="1.0.0.14" initialView="View 1"
productVersion="11.0.6565" PIVersion="1.0.0.0" href="http://agl0057855/
template1.xsn" name="urn:schemas-microsoft-
comffice:infopath:template1:-dataFormSolution" ?>
<?mso-application progid="InfoPath.Document"?>
<dfs:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:q="http://schemas.microsoft.com/office/infopath/2003/ado/
queryFields" xmlns:d="http://schemas.microsoft.com/office/infopath/
2003/ado/dataFields" xmlns:dfs="http://schemas.microsoft.com/office/
infopath/2003/dataFormSolution" xmlns:my="http://schemas.microsoft.com/
office/infopath/2003/myXSD/2007-08-07T06:23:54" xmlns:xd="http://
schemas.microsoft.com/office/infopath/2003" xml:lang="en-au">
<dfs:queryFields>
<q:Wells WellName="" WellStatus="" PPL="" StageNo="" Area=""></
q:Wells>
</dfs:queryFields>
<dfs:dataFields>
<d:Wells WellName="" WellStatus="" PPL="" StageNo="" Area=""></
d:Wells>
</dfs:dataFields>
<my:TestPram>abc</my:TestPram>
</dfs:myFields>
thanks
TJ
I am struggling to access a field using JScript from an aspx web page.
I am basically following the instructions here:
http://blogs.msdn.com/rrawat/archive/2006/08/09/693118.aspx
When my code runs I get the message
Reference to undeclared namespace prefix: 'my'.
My code is:
<script language=jscript>
var oApp = new ActiveXObject("InfoPath.Application");
var oXDocument = oApp.XDocuments.NewFromSolution("http://abc999/
Template1.xsn");
var oParam = oXDocument.DOM.selectSingleNode("//my:TestPram")
alert(oParam.text);
oApp = null;
</script>
I created the field TestPram in my InfoPath form by right clicking
MyFields, clicking Add, typed the name TestPram and clicked OK.
This prefix exists because if I run:
alert(oXDocument.DOM.xml);
I get the following output:
<?xml version="1.0"?>
<?mso-infoPathSolution solutionVersion="1.0.0.14" initialView="View 1"
productVersion="11.0.6565" PIVersion="1.0.0.0" href="http://agl0057855/
template1.xsn" name="urn:schemas-microsoft-
comffice:infopath:template1:-dataFormSolution" ?>
<?mso-application progid="InfoPath.Document"?>
<dfs:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:q="http://schemas.microsoft.com/office/infopath/2003/ado/
queryFields" xmlns:d="http://schemas.microsoft.com/office/infopath/
2003/ado/dataFields" xmlns:dfs="http://schemas.microsoft.com/office/
infopath/2003/dataFormSolution" xmlns:my="http://schemas.microsoft.com/
office/infopath/2003/myXSD/2007-08-07T06:23:54" xmlns:xd="http://
schemas.microsoft.com/office/infopath/2003" xml:lang="en-au">
<dfs:queryFields>
<q:Wells WellName="" WellStatus="" PPL="" StageNo="" Area=""></
q:Wells>
</dfs:queryFields>
<dfs:dataFields>
<d:Wells WellName="" WellStatus="" PPL="" StageNo="" Area=""></
d:Wells>
</dfs:dataFields>
<my:TestPram>abc</my:TestPram>
</dfs:myFields>
thanks
TJ