i want to click the button and it alerts the text that filds in.
my fields is:
myFields
test
i use the code:
XDocument.UI.Alert(XDocument.DOM.selectSingleNode("/myFields/test").text);
but failed , it warns that "Object required!"
i have read the SDK,the sample code also uses the code like mine.why
the sampale can use it, not mine?
i change the code to:
XDocument.UI.Alert(XDocument.DOM.selectSingleNode("//my:myFields/my:test").text);
it is ok.
is there any difference?
can anyone help me ?
when will use"/", and "//", and "my:"
many thanx!
Greg Collins [InfoPath MVP] - 28 Jun 2006 03:06 GMT
the "my:" is called a namespace prefix. It is essential. It is part of the name of the node.
"myFields" is entirely different than "my:myFields"... just as "yo:myFields" would be different.
The "/" is just fine in your scenario... no need to use "//".

Signature
Greg Collins [Microsoft MVP]
Visit Brain Trove ( http://www.BrainTrove.com )
Visit InfoPath Dev ( http://www.InfoPathDev.com )